Rewrite Tree With Subtree Sums
CodingSoftware Engineer
Examples
Example 1:
Input: root1 = [5,2,3,1,4,6,7], root2 = [9,9,9,9,9,9,9]
Output: [28,7,16,1,4,6,7]
Explanation:
Example 2:
Input: root1 = [1,2,3,4,5,6], root2 = [0,0,0,0,0,0]
Output: [21,11,9,4,5,6]