2017myl

Results 2 comments of 2017myl

var inorderTraversal = function(root) { let res=[]; let stack =[]; let cur = root; while(cur || stack.length>0){ while(cur){ stack.push(cur); cur = cur.left; } cur = stack.pop(); res.push(cur.val); cur = cur.right;...

var reverseList = function(head) { var nextCur = head; var lastCur = null; var cur = null; while(nextCur){ cur = nextCur; nextCur = cur.next; cur.next = lastCur; lastCur = cur;...