Rewrite Tree with Subtree Sums

Problem: Rewrite Tree with Subtree Sums

Given a binary tree where each node contains an integer value, rewrite every node's value to be the sum of all original values in the subtree rooted at that...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: