Skip to content

Commit c84913f

Browse files
committed
feat(leetcode): solve 230 - Kth Smallest Element In A Bst
1 parent b4fb54e commit c84913f

5 files changed

Lines changed: 46 additions & 16 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ Total 125
2222
2323
| Field | Value |
2424
|------|------|
25-
| Problem ID | 226 |
26-
| Title | Invert Binary Tree |
25+
| Problem ID | 230 |
26+
| Title | Kth Smallest Element In A Bst |
2727
| Language | Python3 |
2828
| Runtime | 0 ms |
29-
| Memory | 19.1 MB |
29+
| Memory | 22.1 MB |
3030
3131
3232
💻 Languages Used
3333
34-
- **Python3** : 26
34+
- **Python3** : 27
3535
3636
## 📚 Recent Accepted Problems
3737
38+
- 230 Kth Smallest Element In A Bst
3839
- 226 Invert Binary Tree
3940
- 104 Maximum Depth Of Binary Tree
4041
- 235 Lowest Common Ancestor Of A Binary Search Tree
4142
- 124 Binary Tree Maximum Path Sum
42-
- 789 Kth Largest Element In A Stream
4343
4444
4545
---
@@ -81,4 +81,4 @@ Git
8181
GitHub
8282
⏰ Last Sync
8383
84-
2026-07-06 19:56:28
84+
2026-07-06 19:56:30
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"submission_id": "2045534339",
3+
"question_id": "230",
4+
"title_slug": "kth-smallest-element-in-a-bst",
5+
"language": "python3",
6+
"language_verbose": "Python3",
7+
"runtime": "0 ms",
8+
"memory": "22.1 MB",
9+
"status_code": 10,
10+
"timestamp": 1782376047
11+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
9+
stack =[]
10+
while True:
11+
while root:
12+
stack.append(root)
13+
root=root.left
14+
root = stack.pop()
15+
16+
k-=1
17+
if k ==0:
18+
return root.val
19+
root = root.right

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": "2045552347"
2+
"last_submission_id": "2045547332"
33
}

storage/stats.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
"medium": 56,
55
"hard": 6,
66
"languages": {
7-
"Python3": 26
7+
"Python3": 27
88
},
99
"recent_problems": [
10+
{
11+
"id": "230",
12+
"title": "Kth Smallest Element In A Bst"
13+
},
1014
{
1115
"id": "226",
1216
"title": "Invert Binary Tree"
@@ -22,18 +26,14 @@
2226
{
2327
"id": "124",
2428
"title": "Binary Tree Maximum Path Sum"
25-
},
26-
{
27-
"id": "789",
28-
"title": "Kth Largest Element In A Stream"
2929
}
3030
],
3131
"last_problem": {
32-
"id": "226",
33-
"title": "Invert Binary Tree",
32+
"id": "230",
33+
"title": "Kth Smallest Element In A Bst",
3434
"language": "Python3",
3535
"runtime": "0 ms",
36-
"memory": "19.1 MB"
36+
"memory": "22.1 MB"
3737
},
38-
"last_sync": "2026-07-06 19:56:28"
38+
"last_sync": "2026-07-06 19:56:30"
3939
}

0 commit comments

Comments
 (0)