This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Force npm to run node-gyp also as root, preventing permission denied errors in AWS with npm@5 | |
unsafe-perm=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#language = python3 | |
## return a list of steps | |
def findSmallestMult(arr,num): | |
out = [1] | |
# sort the input array | |
arr.sort() | |
# remove 1 from array as we are starting from 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#language = python3 | |
def lordOfTheRing(A): | |
stack = [] | |
for i in range(len(A)-1,-1,-1): | |
# condition for mainintain final 2 players in ring | |
if i==0 and len(stack)==1: | |
stack.append(A[0]) | |
continue | |
# inital condition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
class Graph: | |
def __init__(self): | |
self.graph = defaultdict(list) | |
def make_graph(self,n,connections): | |
self.n=n | |
for conn in connections: | |
self.graph[conn[0]].append(conn[1]) |