Created
August 2, 2018 19:29
-
-
Save cashlo/203e7dd8a57eac269584b6efe6e7f0d6 to your computer and use it in GitHub Desktop.
This file contains 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
class Solution(object): | |
def findContestMatch(self, n): | |
""" | |
:type n: int | |
:rtype: str | |
""" | |
def wrap_thing(a, b): | |
return '({},{})'.format(a,b) | |
to_wrap = [i for i in range(1,n+1)] | |
while len(to_wrap) > 1: | |
new_wrap = [] | |
while to_wrap: | |
new_wrap.append(wrap_thing(to_wrap.pop(0), to_wrap.pop())) | |
to_wrap = new_wrap | |
return to_wrap[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment