508. 出现次数最多的子树元素和
https://leetcode-cn.com/problems/most-frequent-subtree-sum/
解法一:前序+hash
前序遍历,每次递归求和并记录在hash,key为和,值为次数
遍历hash,找出现最多的次数most
再遍历hash,将次数为most的key输出
最后更新于
https://leetcode-cn.com/problems/most-frequent-subtree-sum/
前序遍历,每次递归求和并记录在hash,key为和,值为次数
遍历hash,找出现最多的次数most
再遍历hash,将次数为most的key输出
最后更新于