Pinned Loading
-
-
Topological Sort
Topological Sort 1def topological_sort(graph):
2s, result = set(), []
34def _recurse(u):
5if u not in s:
-
Python trick to find subsequence
Python trick to find subsequence 1How it works
2------------
34Suppose `sequence = 'Hello!'` and `subsequence = 'ello'` then the function would execute like so:
5 -
Python memoize wrapper
Python memoize wrapper 1from functools import wraps
23def memo(f):
4cache = {}
5 -
Basic Sorts
Basic Sorts 1def mergesort(A):
2def _merge(A, left, m, right):
3left_A, right_A = A[left:m], A[m:right]
4left_len, right_len = len(left_A), len(right_A)
5
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.