-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added README.md file for Minimum Depth of Binary Tree
- Loading branch information
1 parent
bb691e8
commit f8896a9
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<h2><a href="https://leetcode.com/problems/minimum-depth-of-binary-tree">Minimum Depth of Binary Tree</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><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> </p> | ||
<p><strong class="example">Example 1:</strong></p> | ||
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/12/ex_depth.jpg" style="width: 432px; height: 302px;" /> | ||
<pre> | ||
<strong>Input:</strong> root = [3,9,20,null,null,15,7] | ||
<strong>Output:</strong> 2 | ||
</pre> | ||
|
||
<p><strong class="example">Example 2:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> root = [2,null,3,null,4,null,5,null,6] | ||
<strong>Output:</strong> 5 | ||
</pre> | ||
|
||
<p> </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> |