Loading...
The Mirror Flip
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- junior, mid
Problem
A UI rendering engine needs to mirror binary tree structures for right-to-left display modes. Write a function that takes the root of a binary tree and inverts it by swapping every left and right child recursively. Return the root of the inverted tree.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.