docs(docs): add Approach diagrams and Explanation sections to LeetCode problem documentation

This commit is contained in:
Prad Nukala committed 2026-09-21 15:53:21 -04:00
1 parent b8c779903f
commit 23eb71d387
19 files changed
+439

No files matched your search

@@ -21,6 +21,16 @@ sidebar:
- The number of nodes in the tree is in the range [0, 10^4].
- `-100 <= Node.val <= 100`
## Approach
```mermaid
flowchart TD
S(["maxDepth(root)"]) --> B{"root is None?"}
B -- yes --> Z(["return 0"])
B -- no --> L["l = maxDepth(root.left), r = maxDepth(root.right)"]
L --> E(["return 1 + max(l, r) — this node adds one level above its deeper subtree"])
```
## Solution
```py
@@ -37,3 +47,7 @@ class Solution:
return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))
```
## Explanation
<YouTube id="hTM3phVI6YQ" title="Maximum Depth of Binary Tree - 3 Solutions - Leetcode 104 - Python" />