Tap here to switch tabs
Problem
Submissions

Problem: Minimum Depth of Binary Tree

med
30 min
Try to solve the Minimum Depth of Binary Tree problem.

Statement

Given the root of a binary tree, return the minimum depth of the tree.

The minimum depth is the number of nodes along the shortest path from root down to the nearest leaf node. A leaf node is a node that has no children.

Note: A leaf node is defined as a node with neither a left child nor a right child.

Constraints:

  • The number of nodes in the tree is in the range [0,105][0, 10^5].

  • 1000-1000 \leq Node.val 1000\leq 1000

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Depth of Binary Tree

med
30 min
Try to solve the Minimum Depth of Binary Tree problem.

Statement

Given the root of a binary tree, return the minimum depth of the tree.

The minimum depth is the number of nodes along the shortest path from root down to the nearest leaf node. A leaf node is a node that has no children.

Note: A leaf node is defined as a node with neither a left child nor a right child.

Constraints:

  • The number of nodes in the tree is in the range [0,105][0, 10^5].

  • 1000-1000 \leq Node.val 1000\leq 1000

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths