Class Solution

java.lang.Object
g1301_1400.s1302_deepest_leaves_sum.Solution

public class Solution extends Object
1302 - Deepest Leaves Sum.<p>Medium</p> <p>Given the <code>root</code> of a binary tree, return <em>the sum of values of its deepest leaves</em>.</p> <p><strong>Example 1:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2019/07/31/1483_ex1.png" alt="" /></p> <p><strong>Input:</strong> root = [1,2,3,4,5,null,6,7,null,null,null,null,8]</p> <p><strong>Output:</strong> 15</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> root = [6,7,8,2,7,1,3,9,null,1,4,null,null,null,5]</p> <p><strong>Output:</strong> 19</p> <p><strong>Constraints:</strong></p> <ul> <li>The number of nodes in the tree is in the range <code>[1, 10<sup>4</sup>]</code>.</li> <li><code>1 <= Node.val <= 100</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • deepestLeavesSum

      public int deepestLeavesSum(TreeNode root)