Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Verbose solution in Clear category for Ground for the House by suic
def house(plan):
plan = [row.strip() for row in plan.split("\n")]
top_bottom = []
left_right = []
for i, row in enumerate(plan):
for j, column in enumerate(row):
if column == "#":
top_bottom.append(j)
left_right.append(i)
if not (top_bottom or left_right):
return 0
return (
(max(top_bottom, default=1) - min(top_bottom, default=1) + 1)
* (max(left_right, default=1) - min(left_right, default=1) + 1)
)
Sept. 3, 2018