https://docs.github.com/en/developers/apps/authenticating-with-github-apps
pip install pyjwt
pip install cryptography
pip install pycryptodomeCreate the token from installation ID
| import bisect | |
| from heapq import * | |
| """ | |
| Linked Lists | |
| A linked list is an ordered collection of values. | |
| Linked lists are similar to arrays in the sense that they contain objects in a linear order. | |
| However they differ from arrays in their memory layout. |
| class Deque(): | |
| """Deque DST""" | |
| def __init__(self): | |
| self._items = [] | |
| def add_front(self, item): | |
| """ | |
| Add to the front | |
| """ |
| """" | |
| Trees | |
| Trees are well known as a non-linear Data Structure. It doesn’t store data in a linear way. It organizes data in a hierarchical way. | |
| - Root: the topmost node of the tree | |
| - Edge: the link between 2 nodes | |
| - Child: a node that has a parent node | |
| - Parent: a node that has an edge to a child node | |
| - Leaf: a node that does not have a child node in the tree |
| class SingleNode(): | |
| def __init__(self, data=None, next=None): | |
| self.data = data | |
| self.next = next | |
| def __repr__(self): | |
| return repr(self.data) | |
| class DoubleNode(): |
| from collections import Counter | |
| def is_unique(word): | |
| # O(N) | |
| # ASCII Table Chars | |
| chars_set = [False for i in range(128)] | |
| for char in word: | |
| val = ord(char) |
| from collections import Counter | |
| def solution(A): | |
| """Gets the index of the dominator of array A""" | |
| counter = Counter() | |
| for i, v in enumerate(A): | |
| counter[v] += 1 | |
| counter = counter.most_common() |
| def solution(A): | |
| count = 0 | |
| peaks = [] | |
| for i in range(len(A)): | |
| if i > 0 and i != (len(A)-1) and A[i] > A[i-1] and A[i] > A[i+1] and A[i] not in peaks: | |
| peaks.append(A[i]) | |
| count += 1 | |
| return count | |
https://docs.github.com/en/developers/apps/authenticating-with-github-apps
pip install pyjwt
pip install cryptography
pip install pycryptodomeCreate the token from installation ID
| #! /usr/bin/env python | |
| from base64 import b64decode | |
| from github import Github | |
| with open('access-token.txt') as token_file: | |
| token = token_file.read().strip() | |
| api = Github(token) | |
| site = api.get_repo('nottrobin/gh-cms-example-site') |