摘要: 深度优先搜索 class Solution { public int diameterOfBinaryTree(TreeNode root) { if (root == null){ return 0; } /** * 包含根节点的最长路径 */ int containRoot = maxDepth 阅读全文
posted @ 2021-12-28 20:42 振袖秋枫问红叶 阅读(29) 评论(0) 推荐(0)
摘要: 深度优先搜索 class Solution { List<String> list = new LinkedList<>(); public String smallestFromLeaf(TreeNode root) { dfs(root, new String()); /** * 按照字符串的字 阅读全文
posted @ 2021-12-28 15:20 振袖秋枫问红叶 阅读(30) 评论(0) 推荐(0)