K19

Maximum Depth of Binary Tree

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: NUMERIC

Problem Statement & Objective

Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from root to leaf.

Function Signature (Python)

maximum_depth_of_binary_tree(root: list) -> int

Input & Output Contract

Output Rule:Maksimum derinlik tam sayısı.

System Constraints

0 <= agac.length <= 10^4
-100 <= agac[i] <= 100

Example Execution Walkthrough

agac = [3, 9, 20, None, None, 15, 7] -> derinlik: 3 (kök -> 20 -> 15)

Example Test Scenarios (3)

Example 1
Input:[[3,9,20,null,null,15,7]]
Expected Output:3
Example 2: İki Seviye
Input:[[1,null,2]]
Expected Output:2
Example 3: Boş Ağaç
Input:[[]]
Expected Output:0
Loading Python Editor...
Input Parameters
[
  [
    3,
    9,
    20,
    null,
    null,
    15,
    7
  ]
]
Expected Output
3