Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Remove and Turn solution in Clear category for Ground for the House by oduvan
EMPTY = '0'
FILLED = '#'
def remove_lines(lines):
if set(lines[0]) == set([EMPTY]):
return remove_lines(lines[1:])
return lines
def turn_lines(lines):
return list(zip(*lines))
def house(plan):
if FILLED not in plan:
return 0
lines = plan.strip().split()
lines = remove_lines(lines)
lines = remove_lines(lines[::-1])
lines = remove_lines(turn_lines(lines))
lines = remove_lines(lines[::-1])
return len(lines) * len(lines[0])
Sept. 3, 2018
Comments: