2
* Definition for a binary tree node.3
* function TreeNode(val, left, right) {4
* this.val = (val===undefined ? 0 : val)5
* this.left = (left===undefined ? null : left)6
* this.right = (right===undefined ? null : right)10
* @param {TreeNode} root13
var isEvenOddTree = function (root) {17
while (queue.length > 0) {18
const currLength = queue.length;21
for (let i = 0; i < currLength; i++) {22
const node = queue[i];23
if (steps % 2 !== 0) {25
(i < currLength - 1 && node.val <= queue[i + 1].val) ||31
(i < currLength - 1 && node.val >= queue[i + 1].val) ||36
if (node.left) nextQueue.push(node.left);37
if (node.right) nextQueue.push(node.right);