Skip to content

Commit 3503ebe

Browse files
committed
Update index.ts
1 parent 534d941 commit 3503ebe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

count-complete-tree-nodes/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TreeNode } from "../binary-tree-inorder-traversal/TreeNode.ts";
33
export default function countNodes(
44
root: TreeNode | null,
55
leftDepth?: number,
6-
rightDepth?: number
6+
rightDepth?: number,
77
): number {
88
if (root === null) return 0;
99
let left = 0,
@@ -32,7 +32,7 @@ export default function countNodes(
3232
}
3333
return (
3434
1 +
35-
countNodes(root.left, left-1) +
36-
countNodes(root.right, undefined, right-1)
35+
countNodes(root.left, left - 1) +
36+
countNodes(root.right, undefined, right - 1)
3737
);
3838
}

0 commit comments

Comments
 (0)