Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
5-liner: easy-peasy solution in Clear category for Ground for the House by przemyslaw.daniel
def house(plane):
size = len(plane.split('\n')[1])
area = [divmod(i, size+1) for i, x in enumerate(plane) if x == '#']
rows, cols = [x for x, _ in area] or [0], [x for _, x in area] or [0]
return (max(rows)-min(rows)+1)*(max(cols)-min(cols)+1)*('#' in plane)
Sept. 3, 2018
Comments: