Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
split, find & rfind solution in Clear category for Ground for the House by DeCooper
def house(plan):
if '#' not in plan:
return 0
grid = plan.split()
no_so, east, west = [], [], []
for index, line in enumerate(grid):
if '#' in line:
no_so.append(index)
east.append(line.find('#'))
west.append(line.rfind('#'))
return (max(no_so) - min(no_so) + 1) * (max(west) - min(east) + 1)
Sept. 3, 2018
Comments: