94. Binary Tree Inorder Traversal
来源:互联网 发布:博创软件oa 编辑:程序博客网 时间:2024/05/22 12:29
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3}
,
1 \ 2 / 3
return [1,3,2]
.
递归喽
public class Solution { public List<Integer> inorderTraversal(TreeNode root) { List<Integer> result = new ArrayList<Integer>(); List<Integer> left = new ArrayList<Integer>(); List<Integer> right = new ArrayList<Integer>(); if (root == null) { return result; } left = inorderTraversal(root.left); right = inorderTraversal(root.right); result.addAll(left); result.add(root.val); result.addAll(right); return result; }}
0 0
- 94. Binary Tree Inorder Traversal
- 94.Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94.Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- 94. Binary Tree Inorder Traversal
- Eclipse运行Applet没有显示图片,getCodeBase,getDocumentBase
- SQL2000+存储过程+触发器+DLL调用的方法来实现数据实时转换
- git版本控制开发
- 5.6
- Table 表格的一些细节
- 94. Binary Tree Inorder Traversal
- 谭浩强C++笔记(13-14章)
- keepalived 各配置项和术语说明
- Runtime那些事儿(消息机制)
- system/WIFEXITED/WEXITSTATUS函数-linux
- java .map()
- Ajax技术
- eclipse 新建项目报错:The import android.support.v7.app cannot be resolved
- 对nutch爬虫的一些理解