← Amazon questions

Convert a binary tree to its sum tree

Filed under Amazon · Also reported at Microsoft, Samsung

Given a binary tree, transform it into a sum tree where each node's new value is equal to the sum of all its left and right subtree nodes' original values. Leaf nodes become 0.

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.