LeetCode(94)Binary Tree Inorder Traversal
题目如下:

Python代码:
def inorderTraversal(self, root):
res = []
self.helper(root, res)
return res def helper(self, root, res):
if root:
self.helper(root.left, res)
res.append(root.val)
self.helper(root.right, res)
LeetCode(94)Binary Tree Inorder Traversal的更多相关文章
- LeetCode(107) Binary Tree Level Order Traversal II
题目 Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from l ...
- LeetCode(103) Binary Tree Zigzag Level Order Traversal
题目 Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left ...
- LeetCode(26)-Binary Tree Level Order Traversal II
题目: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from ...
- LeetCode(102) Binary Tree Level Order Traversal
题目 Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to rig ...
- LeetCode(124) Binary Tree Maximum Path Sum
题目 Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequen ...
- [leetcode] 94. Binary Tree Inorder Traversal 二叉树的中序遍历
题目大意 https://leetcode.com/problems/binary-tree-inorder-traversal/description/ 94. Binary Tree Inorde ...
- 【LeetCode】94. Binary Tree Inorder Traversal (3 solutions)
Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' values ...
- LeetCode 94. 二叉树的中序遍历(Binary Tree Inorder Traversal)
94. 二叉树的中序遍历 94. Binary Tree Inorder Traversal 题目描述 给定一个二叉树,返回它的 中序 遍历. LeetCode94. Binary Tree Inor ...
- 49. leetcode 94. Binary Tree Inorder Traversal
94. Binary Tree Inorder Traversal 二叉树的中序遍历 递归方法: 非递归:要借助栈,可以利用C++的stack
随机推荐
- 关于layui 三级联动 渲染报错解决方法
/** * 时间:2016年11月27日 * 作者:707200833 * 说明:依赖与jQuery和layui, 是基于layui开发的一个省市区联动的小插件, 使用上要基于layui的表单进行使用 ...
- PhotoZoom Classic 7怎么样?对电脑和系统要求高不高?
PhotoZoom Classic 7怎么样?对电脑和系统要求高不高? 相较于更专业PhotoZoom Pro,标准版本的PhotoZoom Classic 7更适用于日常工作中的图片放大处理,例如在 ...
- elasticsearch多种搜索方式
简要 1.query string search2.query DSL3.query filter4.full-text search5.phrase search6.highlight search ...
- JavaScript进阶【三】JavaScript面向对象的基础知识复习
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- BZOJ 2716/2648 SJY摆棋子 (三维偏序CDQ+树状数组)
题目大意: 洛谷传送门 这明明是一道KD-Tree,CDQ分治是TLE的做法 化简式子,$|x1-x2|-|y1-y2|=(x1+y1)-(x2+y2)$ 而$CDQ$分治只能解决$x1 \leq x ...
- iptables防火墙和selinux
iptables 存在以下两种方式: 一.service方式 查看防火墙状态: [root@centos6 ~]# service iptables status iptables:未运行防火墙 开启 ...
- Java基础学习总结(61)——Java项目开发要注意的60个问题
1. 首先写代码的时候最好不要有缺陷.最好的修复方法就是让 bug 胎死腹中. 良好的单元测试 强制数据库约束 使用输入验证框架 避免未实现的"else"条件 在应用到主程序之前知 ...
- BA--空调静压箱的作用
空调静压箱的主要作用有两个,一个是降低噪音:一个是提高送风距离.工作原理如下:空调出风从空调风机里面出来的时候,具有很大的风速,同时由于空调风机自身的结构原因,空调的出风并不均衡,空气在风管中相互摩擦 ...
- 笔试题&面试题:给定n个数,要求比較次数1.5n同一时候找出最大值和最小值
写出一个算法,对给定的n个数的序列,返回序列中的最大和最小的数. 设计出一个算法,仅仅须要运行1.5n次比較就能找到序列中最大和最小的数吗?是否能再少? 分析:要求比較次数为1.5n,使用一般的逐个遍 ...
- Auto property synthesis will not synthesize property 'delegate'; it will be implemented by its super
今天在XCode6.3上面重写TabBar的时候,自己定义tabBar的代理遇到的一个问题 在重写tabBar的代理的时候遇到了一个警告. 解决方法: 在.m文件里 警告消失