Back to course home
0% completed
Vote For New Content
Even Odd Tree (medium)
Problem Statement
Given a binary tree, return true if it is an Even-Odd tree. Otherwise, return false.
The Even-odd tree must follow below two rules:
- At every even-indexedlevel (starting from 0), all node values must beoddand arranged instrictly increasingorder fromlefttoright.
- At every odd-indexedlevel, all node values must beevenand arranged instrictly decreasingorder fromlefttoright.
Examples
Example 1
- Input:
    1
   / \
  10  4
 / \
3   7
- Expected Output: true
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page