Free written solutionReverse Odd Levels of Binary Tree (LeetCode 2415): Solution and Explanation
In a perfect binary tree, reverse the values on every odd level (1, 3, 5, ...) and leave the even levels as they are. Only values change; the tree's shape stays the same.
Read the intuition, approach, code and complexity →