# 22from typing import List
classSolution:defgenerateParenthesis(self, n:int)-> List[str]:
result =[]
self.backtracking(n, result,0,0,"")return result
defbacktracking(self, n, result, left, right, s):if left < right:returnif left == right and left == n:
result.append(s)returnif left < n:
self.backtracking(n, result, left +1, right, s +"(")if left > right:
self.backtracking(n, result, left, right +1, s +")")