View gist:7439552
""" | |
Single-pass, simple solution to waterflow problem. | |
""" | |
q = [2,5,1,3,1,2,1,7,7,6] | |
def solve(heights): | |
water = [0]*len(heights) | |
total = 0 | |
runoff = 0 | |
for i,height in enumerate(heights): | |
if i == 0: |