Skip to content

Instantly share code, notes, and snippets.

@bourneagain
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bourneagain/0cb90851106756746933 to your computer and use it in GitHub Desktop.
Save bourneagain/0cb90851106756746933 to your computer and use it in GitHub Desktop.
To find the water puddle problem to http://qandwhat.runkite.com/i-failed-a-twitter-interview/
def findMax(A):
maxW=0
startValue=A[0]
count=0
for count,i in enumerate(A):
if count==0 or i==A[-1]:
startValue=i
continue
if i<startValue:
maxW=maxW+(startValue-i)
else:
startValue=i
return maxW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment