Conditions | 5 |
Paths | 9 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
48 | private static function helper(array &$ans, TreeNode $node, int $curr): void |
||
49 | { |
||
50 | if ($node === null) { |
||
51 | return; |
||
52 | } |
||
53 | if (count($ans) < $curr + 1) { |
||
54 | $ans[] = []; |
||
55 | } |
||
56 | $ans[$curr][] = $node->val; |
||
57 | |||
58 | if ($node->left) { |
||
59 | self::helper($ans, $node->left, $curr + 1); |
||
60 | } |
||
61 | if ($node->right) { |
||
62 | self::helper($ans, $node->right, $curr + 1); |
||
63 | } |
||
66 |