This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://leetcode.com/problems/validate-binary-search-tree/ | |
// Javascript version for Validate BST Tree using iteration | |
var isValidBST = function(root) { | |
if (!root) return true; | |
const stack = []; | |
let prevNode = null; | |
while(root != null || stack.length > 0) { | |
while(root != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
console.log('love js'); | |
})(); |