SnowflakeSoftware Engineer · Phone ScreenCodemia practiceOptimize traversal for in-place
Given a binary tree, implement an in-place traversal algorithm that optimizes the order of visiting nodes without using additional data structures. Your solution should modify the tree's pointers to achieve a specific traversal order (e.g., pre-order, in-order, or post-order) and return the root of the modified tree. The algorithm should operate within O(n) time complexity and O(1) space complexity.
Medium
Coding & Algorithms