← Amazon questions

Modify tree nodes to store subtree sums

Filed under Amazon

Given the preorder and inorder traversal arrays of a binary tree, reconstruct the tree, then modify each node's value to be the sum of its left and right subtree values. Return the root of the…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.