LeetCode_144Binary Tree Preorder Traversal
来源:互联网 发布:https域名劫持原理 编辑:程序博客网 时间:2024/06/05 19:58
Given a binary tree, return the preorder traversal of its nodes’ values.
For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [1,2,3].
List<Integer> result = new ArrayList<Integer>(); public List<Integer> preorderTraversal(TreeNode root) { resPreorder(root); return result; } private void resPreorder(TreeNode root){ if(root == null) return; result.add(root.val); resPreorder(root.left); resPreorder(root.right); }
0 0
- LeetCode_144Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Leetcode_binary-tree-preorder-traversal
- Binary Tree Preorder Traversal
- CAS4添加验证码
- js正则表达式匹配空格
- Longest Substring Without Repeating Characters
- 链表
- Android BlueTooth通信
- LeetCode_144Binary Tree Preorder Traversal
- Nginx学习之十二-负载均衡-加权轮询策略剖析
- 什么是psr-0,psr-1,psr-2标准
- MongoDB与内存
- Nginx学习之十一-Nginx启动框架处理流程
- 整合:求最短路算法 floyd prim dijkstra Kruskal spfa算法简析
- JTable合并表头
- [BZOJ1031][JSOI2007]字符加密Cipher
- Jquery常用的的选择器及容易忽视的小错误