← Amazon questions

Replace binary tree node data with child sums or propagate difference

Filed under Amazon

Given a binary tree, replace each node's value with the sum of its children if the sum > current value. Otherwise, update the node and propagate the difference to the left child, repeating downwards.

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.