Skip to content

Commit 2afe662

Browse files
committed
feat(leetcode): solve 104 - Maximum Depth Of Binary Tree
1 parent d7841b7 commit 2afe662

5 files changed

Lines changed: 42 additions & 18 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ Total 125
2222
2323
| Field | Value |
2424
|------|------|
25-
| Problem ID | 235 |
26-
| Title | Lowest Common Ancestor Of A Binary Search Tree |
25+
| Problem ID | 104 |
26+
| Title | Maximum Depth Of Binary Tree |
2727
| Language | Python3 |
28-
| Runtime | 66 ms |
29-
| Memory | 22.8 MB |
28+
| Runtime | 0 ms |
29+
| Memory | 20.3 MB |
3030
3131
3232
💻 Languages Used
3333
34-
- **Python3** : 24
34+
- **Python3** : 25
3535
3636
## 📚 Recent Accepted Problems
3737
38+
- 104 Maximum Depth Of Binary Tree
3839
- 235 Lowest Common Ancestor Of A Binary Search Tree
3940
- 124 Binary Tree Maximum Path Sum
4041
- 789 Kth Largest Element In A Stream
4142
- 1127 Last Stone Weight
42-
- 1014 K Closest Points To Origin
4343
4444
4545
---
@@ -81,4 +81,4 @@ Git
8181
GitHub
8282
⏰ Last Sync
8383
84-
2026-07-06 19:56:24
84+
2026-07-06 19:56:26
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"submission_id": "2045552347",
3+
"question_id": "104",
4+
"title_slug": "maximum-depth-of-binary-tree",
5+
"language": "python3",
6+
"language_verbose": "Python3",
7+
"runtime": "0 ms",
8+
"memory": "20.3 MB",
9+
"status_code": 10,
10+
"timestamp": 1782377105
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Definition for a binary tree node.
2+
# class TreeNode:
3+
# def __init__(self, val=0, left=None, right=None):
4+
# self.val = val
5+
# self.left = left
6+
# self.right = right
7+
class Solution:
8+
def maxDepth(self, root: Optional[TreeNode]) -> int:
9+
if not root:
10+
return 0
11+
leftDepth= self.maxDepth(root.left)
12+
rightDepth=self.maxDepth(root.right)
13+
return 1+ max(leftDepth, rightDepth)

storage/state.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"last_submission_id": "2048068140"
2+
"last_submission_id": "2046953410"
33
}

storage/stats.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
"medium": 56,
55
"hard": 6,
66
"languages": {
7-
"Python3": 24
7+
"Python3": 25
88
},
99
"recent_problems": [
10+
{
11+
"id": "104",
12+
"title": "Maximum Depth Of Binary Tree"
13+
},
1014
{
1115
"id": "235",
1216
"title": "Lowest Common Ancestor Of A Binary Search Tree"
@@ -22,18 +26,14 @@
2226
{
2327
"id": "1127",
2428
"title": "Last Stone Weight"
25-
},
26-
{
27-
"id": "1014",
28-
"title": "K Closest Points To Origin"
2929
}
3030
],
3131
"last_problem": {
32-
"id": "235",
33-
"title": "Lowest Common Ancestor Of A Binary Search Tree",
32+
"id": "104",
33+
"title": "Maximum Depth Of Binary Tree",
3434
"language": "Python3",
35-
"runtime": "66 ms",
36-
"memory": "22.8 MB"
35+
"runtime": "0 ms",
36+
"memory": "20.3 MB"
3737
},
38-
"last_sync": "2026-07-06 19:56:24"
38+
"last_sync": "2026-07-06 19:56:26"
3939
}

0 commit comments

Comments
 (0)