(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf
:
"""finds the shortest path that an ant could take to reach a point from another | |
constraint: the ant can move only to the right or up at any point | |
""" | |
grid_order = 4 | |
grid = {} | |
index = {} | |
rev_index = {} | |
adj_list = {} |
"""takes a list x and returns a list with odd integers or elements with even index""" | |
[i for idx,i in enumerate(x) if (type(i) is int) and (i%2 !=0 or idx%2==0)] |
def count_set_bits(i): | |
return bin(i).count('1') | |
def sort_set_bits(lst): | |
"""sorts a list based on the number of set bits in each digit""" | |
return sorted(lst, key=count_set_bits) |
def make_complete_graph(num_nodes): | |
"""takes number of nodes and returns a dict that represents | |
a complete graph(no self loops) with num_nodes""" | |
return {x: set([(lambda y: y)(y) for y in xrange(num_nodes) if y!= x]) for x in xrange(num_nodes)} | |
#remove the y!=x condition for self loops |