Skip to content

Instantly share code, notes, and snippets.

@letroot
Created September 16, 2015 18:50
Show Gist options
  • Save letroot/1ac5d382bb3c9e04ff4c to your computer and use it in GitHub Desktop.
Save letroot/1ac5d382bb3c9e04ff4c to your computer and use it in GitHub Desktop.
def multiply(x, y):
if y == 0:
return 0
z = multiply(x, y/2)
if y%2 == 0:
return 2*z
else:
return x + 2*z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment