Skip to content

Latest commit

 

History

History
10 lines (9 loc) · 201 Bytes

File metadata and controls

10 lines (9 loc) · 201 Bytes

Idea

just BFS right, when level goes up, we insert a new list [] at the beginning of result:

result.insert(0, [])

for the nodes in the same level:

result[0].append(node.val)