LeetCode:94.二叉树的中序遍历
var inorderTraversal = function(root) {if(!root)return [];let stack=[]let node=rootlet nlet result=[]while(stack.length||node){while(node){stack.push(node)node=node.left}n=stack.pop()result.push(n.val)node=n.right} return result
};var inorderTraversal = function(root) {if(!root)return [];let reuslt=[]function inOrder(node){if(node.left) inOrder(node.left)reuslt.push(node.val)if(node.right) inOrder(node.right)}inOrder(root)return reuslt
};