为下一代考虑, 高智商女才是贡献# Piebridge - 鹊桥
s*r
1 楼
250 Count Univalue Subtrees
Given a binary tree, count the number of uni-value subtrees.
A Uni-value subtree means all nodes of the subtree have the same value.
For example:
Given binary tree,
5
/ \
1 5
/ \ \
5 5 5
return 4.
195 / 197 test cases passed.
有一个case通不过
Input:
[5,5,5,5,5,null,5]
Output:
4
Expected:
6
实在没看出来有6个,是我题目理解不对?
Given a binary tree, count the number of uni-value subtrees.
A Uni-value subtree means all nodes of the subtree have the same value.
For example:
Given binary tree,
5
/ \
1 5
/ \ \
5 5 5
return 4.
195 / 197 test cases passed.
有一个case通不过
Input:
[5,5,5,5,5,null,5]
Output:
4
Expected:
6
实在没看出来有6个,是我题目理解不对?