Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Fixed First (additional asserts ) solution in Clear category for Ground for the House by Merzix
def get_len(row:str):
start = end = 0
for i, row in enumerate(row, 1):
if '#' in row:
if not start:
start = i
end = i + 1
return end - start
def house(plan:str):
plan = plan.split()
height = get_len(plan)
width = get_len(map(''.join, zip(*plan)))
return height * width
if __name__ == '__main__':
assert house('''0000
0000
0000
''') == 0
assert house('''0000
0##0
##00
''') == 6
assert house('''0000
00#0
#000
''') == 6
Sept. 3, 2018