比较简单的字符串拼接...
class Solution:
def findContestMatch(self, n: int) -> str:
l = [i for i in range(1,n+1)]
while len(l) > 2:
new = []
length = len(l)
for i in range(0,length//2):
strs = '('+ str(l[i]) + ','+str(l[length-i-1])+')'
new.append(strs)
if length %2 != 0:
strs = '('+str(l[length//2])+')'
new.append(strs)
l = new
strs = '(' + str(l[0]) + ',' + str(l[1]) + ')'
return strs