Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Naive solution in Clear category for Ground for the House by obone
def house(plan):
if not '#' in plan:
return 0
plan = plan.strip().split('\n')
a, b, c, d = len(plan), 0, len(plan[0]), 0
for i in range(len(plan)):
if '#' in plan[i]:
a = min(a, plan[i].find('#'))
b = max(b, plan[i].rfind('#'))
c = min(i, c)
d = max(i, d)
return (b - a + 1) * (d - c + 1)
July 22, 2019
Comments: