Skip to content

Instantly share code, notes, and snippets.

def query_to_dic(query):
no_char = query.translate({ord(c): " " for c in "!@#$%^&*()[]{};:,./<>?\|`~-=_+"})
no_char_list = no_char.split()
return dict(no_char_list[i:i + 2] for i in range(0, len(no_char_list), 2))
def ana(a, b)
a = list(a).sort()
b = list(b).sort()
return a == b
@han8909227
han8909227 / gist:e3ac031d5ec74f3291abb8ec604af514
Last active December 6, 2017 17:33
Partition a Linked List
def dl_partition(x, ll):
less_list = []
higher_list = []
for node in ll:
if node.data >= x:
higher_list.append(node.data)
else:
lower_list.append(node.data)
less_list.reverse()
higher_list.reverse()
def zero_matrix(matrix):
"""Take a matrix m x n, if any val is zero set the entire row/column to zero"""
zero_loc = []
for j in range(len(matrix)):
for i in range(len(matrix[0])):
if matrix[j][i] == 0:
zero_loc.push((j,i))
for j, i in zero_loc:
@han8909227
han8909227 / HanResume.md
Last active May 4, 2018 20:19
Resume for Han Bao

Han Bao

Email | GitHub | LinkedIn | Website | Blog

Objective

Dedicated software development engineer with full project cycle experience from design to implementation to integration. Self-motivated and ambitious, always eager to learn new developing techniques and developer technologies, highly adaptable to new challenges. Effective in communication and team works.

Projects