CodingReported in a candidate post, Sep 2020
Replace Node Value with Subtree Sums
Filed under Samsung
The question
Given a binary tree, replace the value of every node by the sum of all values of its left and right subtrees, excluding the node itself, without allocating extra memory.
No write-up yet. Related questions below have one.
Related Samsung questions
Collected from public candidate posts and coding forums. Updated Nov 2026.