Skip to content

Commit 12a3277

Browse files
authored
Added spacing
1 parent 03c63e7 commit 12a3277

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

javascript/1609-even-odd-tree.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var isEvenOddTree = function(root) {
2121

2222
for (let i = 0; i < arr.length; i++) {
2323
const currElement = arr[i];
24-
const nextElement = (arr[i+1] !== undefined && arr[i+1]) || Infinity;
25-
if (currElement >= nextElement || currElement%2 === 0) return false;
24+
const nextElement = (arr[i + 1] !== undefined && arr[i + 1]) || Infinity;
25+
if (currElement >= nextElement || currElement % 2 === 0) return false;
2626
}
2727

2828
return true;
@@ -33,8 +33,8 @@ var isEvenOddTree = function(root) {
3333

3434
for (let i = 0; i < arr.length; i++) {
3535
const currElement = arr[i];
36-
const nextElement = (arr[i+1] !== undefined && arr[i+1]) || -Infinity;
37-
if (currElement <= nextElement || currElement%2 === 1) return false;
36+
const nextElement = (arr[i + 1] !== undefined && arr[i + 1]) || -Infinity;
37+
if (currElement <= nextElement || currElement % 2 === 1) return false;
3838
}
3939

4040
return true;
@@ -55,12 +55,12 @@ var isEvenOddTree = function(root) {
5555
const node = element[0];
5656
levelArr.push(node.val);
5757

58-
node.left && q.enqueue([node.left, level+1]);
59-
node.right && q.enqueue([node.right, level+1]);
58+
node.left && q.enqueue([node.left, level + 1]);
59+
node.right && q.enqueue([node.right, level + 1]);
6060
}
6161

62-
if (level%2 === 0 && !isStricklyIncreasingAndOdd(levelArr)) return false;
63-
if (level%2 === 1 && !isStricklyDecreasingAndEven(levelArr)) return false;
62+
if (level % 2 === 0 && !isStricklyIncreasingAndOdd(levelArr)) return false;
63+
if (level % 2 === 1 && !isStricklyDecreasingAndEven(levelArr)) return false;
6464
}
6565

6666
return true;

0 commit comments

Comments
 (0)