Skip to content

Instantly share code, notes, and snippets.

@thisiswei
Last active December 18, 2015 10:49
Show Gist options
  • Save thisiswei/5771212 to your computer and use it in GitHub Desktop.
Save thisiswei/5771212 to your computer and use it in GitHub Desktop.
def getFinalAmount(initial, res):
def helper(total, bet, n):
return (total if n > len(res) - 1 or bet > total else
helper(total-bet, bet*2, n+1) if res[n] == 'L' else
helper(total+bet, 1, n+1))
return helper(initial, 1, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment