java.lang.Object
g0101_0200.s0111_minimum_depth_of_binary_tree.Solution

public class Solution extends Object
111 - Minimum Depth of Binary Tree.<p>Easy</p> <p>Given a binary tree, find its minimum depth.</p> <p>The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.</p> <p><strong>Note:</strong> A leaf is a node with no children.</p> <p><strong>Example 1:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2020/10/12/ex_depth.jpg" alt="" /></p> <p><strong>Input:</strong> root = [3,9,20,null,null,15,7]</p> <p><strong>Output:</strong> 2</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> root = [2,null,3,null,4,null,5,null,6]</p> <p><strong>Output:</strong> 5</p> <p><strong>Constraints:</strong></p> <ul> <li>The number of nodes in the tree is in the range <code>[0, 10<sup>5</sup>]</code>.</li> <li><code>-1000 <= Node.val <= 1000</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • minDepth

      public int minDepth(TreeNode root)