Skip to content

Instantly share code, notes, and snippets.

@vedgar
Created July 26, 2017 16:07
Show Gist options
  • Select an option

  • Save vedgar/9551d8f3c3ce3c242c00d11cabd9a18c to your computer and use it in GitHub Desktop.

Select an option

Save vedgar/9551d8f3c3ce3c242c00d11cabd9a18c to your computer and use it in GitHub Desktop.
Mystery function
def a(p, q):
d = [p, q]
while len(d) > 1:
if not d[-2]: d[-1] = d.pop() + 1
elif not d[-1]: d[-2] -= 1; d[-1] = 1
else: d.append(d[-1] - 1); d[-2] = d[-3]; d[-3] -= 1
return d.pop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment