Skip to content

Commit d59c314

Browse files
committed
https://leetcode.cn/problems/KnLfVT/
1 parent 41c32d8 commit d59c314

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

KnLfVT/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { TreeNode } from "../binary-tree-inorder-traversal/TreeNode.ts";
2+
3+
export default function expandBinaryTree(
4+
root: TreeNode | null,
5+
): TreeNode | null {
6+
return root
7+
? new TreeNode(
8+
root.val,
9+
root.left ? new TreeNode(-1, expandBinaryTree(root.left)) : null,
10+
root.right
11+
? new TreeNode(-1, null, expandBinaryTree(root.right))
12+
: null,
13+
)
14+
: null;
15+
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Step 2. Add the dependency
4545

4646
<summary>展开查看</summary>
4747

48+
https://leetcode.cn/problems/KnLfVT/
49+
4850
https://leetcode.cn/problems/letter-case-permutation/
4951

5052
https://leetcode.cn/problems/count-items-matching-a-rule/

0 commit comments

Comments
 (0)