Leetcode 257. Binary Tree Paths
来源:互联网 发布:java常用api详解 编辑:程序博客网 时间:2024/06/03 23:56
public class Solution { public List<String> binaryTreePaths(TreeNode root) { List<String> ret = new ArrayList<>(); helper(root, ret, ""); return ret; } public static void helper(TreeNode t, List<String> ret, String tmp) { if (t == null) return; // found a leaf, end of a path if (t.left == null && t.right == null) { tmp += t.val; ret.add(new String(tmp)); return; } tmp += t.val; tmp += "->"; helper(t.left, ret, tmp); helper(t.right, ret, tmp); }}
0 0
- [leetcode] 257. Binary Tree Paths
- 257. Binary Tree Paths LeetCode
- 【LeetCode】257. Binary Tree Paths
- LeetCode 257. Binary Tree Paths
- LeetCode *** 257. Binary Tree Paths
- leetcode 257. Binary Tree Paths
- LeetCode 257. Binary Tree Paths
- Leetcode 257. Binary Tree Paths
- LeetCode-257.Binary Tree Paths
- 【leetcode】257. Binary Tree Paths
- [Leetcode]257. Binary Tree Paths
- LeetCode - 257. Binary Tree Paths
- LeetCode 257. Binary Tree Paths
- [leetcode] 257. Binary Tree Paths
- LeetCode 257. Binary Tree Paths
- 257.[Leetcode]Binary Tree Paths
- LeetCode 257. Binary Tree Paths
- leetcode 257. Binary Tree Paths
- Java:String和Date、Timestamp之间的转换
- javascript流程控制、循环控制
- CPU/内存/缓存行/Disruptor
- servlet_05 servlet使用表单的GET方法实例
- java多线程总结
- Leetcode 257. Binary Tree Paths
- Light OJ 1024(高精度乘)
- Eclipse4.3 swt 插件在线安装
- 小程序-编辑器插件
- C语言再学习-- readelf、objdump、nm使用详解
- HMC(Hamiltonian Monte Carlo抽样算法详细介绍)
- hdu1401 Solitaire双向bfs
- 从存在的价值到人与机器的价值观
- 图形学笔记:图形管线