```
class Solution:
# @param {TreeNode} root
# @return {integer[][]}
def levelOrder(self, root):
traversal = []
if root:
self.recurse([root], traversal)
return traversal
def recurse(self, q, traversal):
temp = []
new_q = []
while q:
current = q.pop(0)
if current.left:
new_q.append(current.left)
if current.right:
new_q.append(current.right)
temp.append(current.val)
traversal.append(temp)
if not new_q:
return
self.recurse(new_q, traversal)
```