← Amazon questions

Sum of nodes at odd vs even height

Filed under Amazon

Given the root of a binary tree, compute the difference between the sum of node values at odd heights and the sum of node values at even height. Assume the root is at height 1.

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.