Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 241 Bytes

File metadata and controls

18 lines (16 loc) · 241 Bytes

Idea

just BFS right, when level goes up:

result.append([])

for the nodes in the same level:

result[-1].append(node.val)

Note:

if level % 2:
		res[-1].append(node.val)
else:
		res[-1].appendleft(node.val)