Consider it as a tree problem, the root node is (, and for this tree's children, we could only choose to add ( or ), if n == 2, the tree will look like

```
# if n == 2
# tree will look like
# (
# (( ()
# (() ()(
# (()) ()()
# Leaf nodes are the strs we wanted
# In order to get all leaves, we need to traverse this tree any how
# Here we use BFS to collect all leaf nodes
class Solution(object):
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
from collections import deque
dq = deque()
dq.append(['(', 1, 0])
res = []
while dq:
current, leftCount, rightCount = dq.popleft() # get current status, and its left and right count
if leftCount < n: # append (
currentLeft = current + '('
newLeftCount = leftCount + 1
dq.append([currentLeft, newLeftCount, rightCount])
if rightCount < leftCount and rightCount < n: # append )
currentRight = current + ')'
newRightCount = rightCount + 1
dq.append([currentRight, leftCount, newRightCount])
if leftCount == rightCount == n:
res.append(current) # found the leaf node, and append it to res
return res
```