Created
July 26, 2017 16:07
-
-
Save vedgar/9551d8f3c3ce3c242c00d11cabd9a18c to your computer and use it in GitHub Desktop.
Mystery function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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