Skip to content

Instantly share code, notes, and snippets.

@thisiswei
Created June 13, 2013 06:40
Show Gist options
  • Save thisiswei/5771660 to your computer and use it in GitHub Desktop.
Save thisiswei/5771660 to your computer and use it in GitHub Desktop.
getFinal initial res = helper initial 1 0
where helper total bet n = if n > (length res) - 1 || bet > total.
then total
else if res !! n == 'L'.
then helper (total-bet) (bet*2) (n+1)
else helper (total+bet) 1 (n+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment