Total Complexity | 13 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class BinaryTreeInorderTraversal |
||
10 | { |
||
11 | public static function inorderTraversal(TreeNode $root): array |
||
31 | } |
||
32 | |||
33 | public static function inorderTraversal2(TreeNode $root): array |
||
34 | { |
||
35 | if (empty($root)) { |
||
36 | return []; |
||
37 | } |
||
38 | $ans = []; |
||
39 | self::helper($root, $ans); |
||
40 | |||
41 | return $ans; |
||
42 | } |
||
43 | |||
44 | private static function helper(TreeNode $root, array & $arr): void |
||
55 | } |
||
56 | } |
||
59 |