1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/开幕式焰火 [sZ59z6].md
2022-03-29 12:43:11 +08:00

24 lines
584 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

「力扣挑战赛」开幕式开始了,空中绽放了一颗二叉树形的巨型焰火。
给定一棵二叉树 `root` 代表焰火,节点值表示巨型焰火这一位置的颜色种类。请帮小扣计算巨型焰火有多少种不同的颜色。
**示例 1**
>输入:`root = [1,3,2,1,null,2]`
>
>输出:`3`
>
>解释:焰火中有 3 个不同的颜色,值分别为 1、2、3
**示例 2**
>输入:`root = [3,3,3]`
>
>输出:`1`
>
>解释:焰火中仅出现 1 个颜色,值为 3
**提示:**
- `1 <= 节点个数 <= 1000`
- `1 <= Node.val <= 1000`