We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e7596cb commit 2ea9c51Copy full SHA for 2ea9c51
README.md
@@ -10,6 +10,8 @@ leetcode 测试
10
11
##### 包含的内容如下
12
13
+https://leetcode.cn/problems/sZ59z6/
14
+
15
https://leetcode.cn/problems/LwUNpT/
16
17
https://leetcode.cn/problems/change-minimum-characters-to-satisfy-one-of-three-conditions/
sZ59z6/index.ts
@@ -0,0 +1,16 @@
1
+import { TreeNode } from "../mod.ts";
2
3
+export default function numColor(root: TreeNode | null): number {
4
+ if (!root) return 0;
5
+ const set = new Set<number>();
6
7
+ const q = [root];
8
9
+ for (const node of q) {
+ set.add(node.val);
+ ([node.left, node.right].filter(Boolean) as typeof q).forEach((n) =>
+ q.push(n)
+ );
+ }
+ return set.size;
+}
0 commit comments