Search
⌘K

Leetcode 2415. Reverse Odd Levels of Binary Tree

Given a perfect binary tree, reverse the node values at every odd-numbered level (1, 3, 5, ...) so that the sequence of values on each odd level is reversed, and return the modified tree. The perfect-tree property lets you pair symmetric nodes across each level and swap their values in-place.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.