Skip to content

Instantly share code, notes, and snippets.

@asross
Created March 11, 2014 00:31
Show Gist options
  • Save asross/9477300 to your computer and use it in GitHub Desktop.
Save asross/9477300 to your computer and use it in GitHub Desktop.
def twitter_puddle(wall):
height = max(wall)
total = 0
for x in range(1, len(wall)-2):
lowest_wall = min(max(wall[:x]), max(wall[x+1:]))
if lowest_wall > wall[x]:
total += lowest_wall - wall[x]
return total
assert(twitter_puddle([2, 5, 1, 2, 3, 4, 7, 7, 6]) == 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment