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] 您需要在二叉树的每一行中找到最大的值. 示例: 输入: 1 / \ 3 2 / \ \ 5 3 9 输出: [1, 3, 9] 48ms /** * Definition for a binary tree node. * public class Tree…
/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNode(int x) { val = x; } * } */ public class Solution { Queue<TreeNode> Q = new Queue<TreeNode>(…
515. 在每个树行中找最大值 515. Find Largest Value in Each Tree Row 题目描述 You need to find the largest value in each row of a binary tree. 您需要在二叉树的每一行中找到最大的值. LeetCode515. Find Largest Value in Each Tree Row Example: Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9…