Add coding exercises for Facebook interviews

Add attempts at solving coding problems to Briefcase.
This commit is contained in:
William Carroll 2020-11-12 14:37:29 +00:00
parent d2d772e43e
commit aa66d9b83d
66 changed files with 2994 additions and 0 deletions

19
scratch/facebook/utils.py Normal file
View file

@ -0,0 +1,19 @@
def init_table(rows=0, cols=0, default=None):
table = []
for row in range(rows):
x = []
for col in range(cols):
x.append(default)
table.append(x)
return table
def get(table, row, col, default=0):
if row < 0 or col < 0:
return default
return table[row][col]
def print_table(table):
result = []
for row in range(len(table)):
result.append(' '.join([str(cell) for cell in table[row]]))
print('\n'.join(result))