Leaves in Same Level
Given a binary tree root
, return whether all leaves are at the same level.
Constraints
n ≤ 100,000
wheren
is the number of nodes inroot
https://binarysearch.com/problems/Leaves-in-Same-Level
Examples
Example 1
Input
- root =
Output
- answer =
False
Explanation
Leaves 2
and 4
are on different levels.
Example 2
Input
- root =
Output
- answer =
True
Explanation
Leaves 2
and 0
are on the same level.
Leave a comment