Find number of subtrees with the same value# JobHunting - 待字闺中
w*z
1 楼
我给个题吧。最近面试碰到的
Find number of subtrees in a tree which all nodes have the same value.
public int FindNumberOfSubTreesWithSameValue(Node root)
Note:
The leaf node itself is a subtree.
5
1 2
1 3
1
answer is 4
Find number of subtrees in a tree which all nodes have the same value.
public int FindNumberOfSubTreesWithSameValue(Node root)
Note:
The leaf node itself is a subtree.
5
1 2
1 3
1
answer is 4