Simple Python Solution


  • 0
    class Solution(object):
        def findContestMatch(self, n):
            t = range(1,n+1)
            while n > 1:
                for i in range(n/2):
                    t[i] = [t[i], t[n-i-1]]
                n >>= 1
            return str(t[0]).replace(' ','').replace('[','(').replace(']',')')

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.