As reported: Microsoft L61 SDE2 (Nov 2025 drive), round 2: after project questions and a discussion of distributed vs single-machine caches, LeetCode Reverse Odd Levels of Binary Tree; pseudo code was allowed.
Given the root of a perfect binary tree, reverse the node values at each odd level (the root is level 0). Return the root.
This is LeetCode 2415 — Reverse Odd Levels of Binary Tree.
Example 1
root = [2,3,5,8,13,21,34] -> [2,5,3,8,13,21,34]
Example 2
root = [0,1,2,0,0,0,0,1,1,1,1,2,2,2,2] -> [0,2,1,0,0,0,0,2,2,2,2,1,1,1,1]
Constraints: 1 ≤ number of nodes ≤ 2^14; 0 ≤ Node.val ≤ 10^5; the tree is perfect.
Code runner format: one JSON value per line: root as a level-order array (LeetCode's format). Implement reverseOddLevels(root); the harness prints the tree.