二叉树中序遍历——94. Binary Tree Inorder Traversal
来源:互联网 发布:Js委托和代理的区别 编辑:程序博客网 时间:2024/05/17 07:41
94. Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes’ values.
For example:
Given binary tree [1,null,2,3],
1
\
2
/
3
return [1,3,2].
/** * Definition for a binary tree node. * function TreeNode(val) { * this.val = val; * this.left = this.right = null; * } *//** * @param {TreeNode} root * @return {number[]} */var inorderTraversal = function(root) { var stack = [], node, result = []; if (!root) return result; node = root; while (node || stack.length) { while (node) { stack.push(node); node = node.left; } node = stack.pop(); result.push(node.val); node = node.right; } return result;};
阅读全文
0 0
- 二叉树中序遍历——94. Binary Tree Inorder Traversal
- 【二叉树中序遍历】Binary Tree Inorder Traversal
- [leetcode-二叉树中序遍历]--94. Binary Tree Inorder Traversal
- leetcode 94. Binary Tree Inorder Traversal 二叉树中序递归遍历
- 【LeetCode】Binary Tree Inorder Traversal ---二叉树中序遍历
- Binary Tree Inorder Traversal 二叉树中序遍历@LeetCode
- Leetcode: Binary Tree Inorder Traversal(二叉树中序遍历)
- Leetcode Binary Tree Inorder Traversal 二叉树中序遍历
- 二叉树中序遍历Binary Tree Inorder Traversal (Java)
- LeetCode 94 Binary Tree Inorder Traversal(二叉树中序遍历)
- 94.Binary Tree Inorder Traversal(二叉树先序遍历)
- 二叉树遍历94. Binary Tree Inorder Traversal
- leetCode 94.Binary Tree Inorder Traversal(二叉树中序遍历) 解题思路和方法
- Leetcode 94. Binary Tree Inorder Traversal 二叉树中序遍历 解题报告
- Binary Tree Inorder Traversal——二叉树的中序遍历
- 5.1.2—二叉树的遍历—Binary Tree Inorder Traversal
- LeetCode—***Binary Tree Inorder Traversal二叉树的中序遍历
- LeetCode Binary Tree Inorder Traversal 中序遍历二叉树
- junit测试Struts2
- nanopc python 安装记录
- 算法竞赛入门经典(第2版)习题5-7 打印队列 UVa12100
- 稀疏编码
- nginx负载均衡配置
- 二叉树中序遍历——94. Binary Tree Inorder Traversal
- PC和移动端浏览器同步测试工具Browsersync使用介绍
- 测试开通博客
- 音视频数据处理(5)---- WAV格式详解
- 【腾讯TMQ】【测试左移专栏】从测试左移到工程生产力
- angularJS 服务
- 批处理bat
- 自定义右键菜单
- 博客搬家了