Quant Memo
Coding/●●●●●

Read a desk hierarchy level by level

Given a binary tree (say, a reporting hierarchy), output its node values grouped by level: all depth-0 nodes, then depth-1, and so on, left to right within each level.

        1
       / \
      2   3
     / \
    4   5
-> [[1], [2, 3], [4, 5]]

Return a list of levels, each a left-to-right list of values.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions