Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum Depth of Binary Tree #55

Open
Rajesh-1234567 opened this issue Oct 9, 2024 · 1 comment
Open

Maximum Depth of Binary Tree #55

Rajesh-1234567 opened this issue Oct 9, 2024 · 1 comment
Assignees

Comments

@Rajesh-1234567
Copy link

Given the root of a binary tree, write an algorithm to find its maximum depth.

  • The maximum depth of a binary tree is the number of nodes along the longest path from the root node down to the farthest leaf node.

Input:

  • A binary tree's root node.

Output:

  • An integer representing the maximum depth of the binary tree.

Constraints:

  • The number of nodes in the tree is in the range [0, 10^4].
  • The depth of an empty tree is 0.

Example 1:

Input:
    3
   / \
  9  20
     /  \
    15   7

Output: 3

Explanation: The longest path is root -> 20 -> 7, which has 3 nodes.

Example 2:

Input:
    1
     \
      2

Output: 2

Explanation: The tree has a maximum depth of 2, since the longest path is root -> 2.

Example 3:

Input: None (Empty tree)

Output: 0

Explanation: The tree is empty, so the maximum depth is 0.

Hey @indrakishore !
Kindly assign me this task.

@shrutipuskar
Copy link

plz assign this task to me and also add hactoberfest tag........

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants