Skip to content

Instantly share code, notes, and snippets.

@cashlo
Created August 2, 2018 19:29
Show Gist options
  • Save cashlo/203e7dd8a57eac269584b6efe6e7f0d6 to your computer and use it in GitHub Desktop.
Save cashlo/203e7dd8a57eac269584b6efe6e7f0d6 to your computer and use it in GitHub Desktop.
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