要求 给定一棵二叉树,返回所有表示从根节点到叶子节点路径的字符串 思路 递归地返回左右子树到叶子节点的字符串 示例 1 class Solution { 2 public: 3 vector<string> binaryTreePaths(TreeNode* root) { 4 5 vector<s ...
分类:
其他好文 时间:
2020-04-12 10:44:25
阅读次数:
60
public class Solution { List result = new ArrayList(); public List binaryTreePaths(TreeNode root) { if (root == null) { return...
分类:
其他好文 时间:
2015-11-29 10:41:07
阅读次数:
173
题目:
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ 2 3
5
All root-to-leaf paths are:
["1->2->5", "1->3"]
...
分类:
编程语言 时间:
2015-08-20 22:38:02
阅读次数:
259