BFS / DFS
Crystal_ting
个人博客 limengting.site
展开
-
513. Find Bottom Left Tree Value(Java)
Given a binary tree, find the leftmost value in the last row of the tree.Example 1: Input: 2 / \ 1 3Output: 1Example 2: Input: 1 / \ 2 3 / / \ 4 5 6原创 2017-08-14 16:21:24 · 307 阅读 · 0 评论 -
515. Find Largest Value in Each Tree Row(Java)
You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]/** * Definition for a binary tr原创 2017-08-14 17:29:47 · 287 阅读 · 0 评论 -
[4]《剑指offer》二叉树中和为某一值的路径
题目描述 输入一颗二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径。路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径。 import java.util.ArrayList; /** public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = ...原创 2018-05-02 15:28:57 · 218 阅读 · 0 评论