K19
Maximum Depth of Binary Tree
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) -> intInput & Output Contract
Output Rule:Maksimum derinlik tam sayısı.
System Constraints
0 <= agac.length <= 10^4
-100 <= agac[i] <= 100Example 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:
3Example 2: İki Seviye
Input:
[[1,null,2]]Expected Output:
2Example 3: Boş Ağaç
Input:
[[]]Expected Output:
0