Dsa
Trees
Medium
Inverted Tree Path Length
Given a binary tree, invert it and return the maximum path length from the root to any leaf in the inverted tree.
Input format:
- The first line contains an integer N (1 ≤ N ≤ 1000), the number of nodes.
- The next N lines contain node values, left, and right children (use -1 for non-existent children).
Output format:
- Print the maximum path length from root to leaf in the inverted tree.
Example input:
3
1 2 3
2 -1 -1
3 -1 -1
Example output:
2
Key concepts
binary treeinverted treepath length
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now