← Nvidia questions
CodingReported in a candidate post, Oct 2021

Convert a tree to a sum tree

Filed under Nvidia

Convert a binary tree to a sum tree: replace each node's value with the sum of the original values in its left and right subtrees (leaf nodes become 0). Do it in O(n).

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 Nvidia questions

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