Solve Twitter "water holding capacity" prob

See http://qandwhat.apps.runkite.com/i-failed-a-twitter-interview/
for the original problem description.