Skip to content

Commit fa58931

Browse files
authored
Update Kth Smallest Element in a BST - Leetcode 230.py
1 parent 1d2e0e5 commit fa58931

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Kth Smallest Element in a BST - Leetcode 230.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
# self.right = right
77
class Solution:
88
def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
9-
k_ans = [k]
9+
count = [k]
1010
ans = [0]
1111

1212
def dfs(node):
1313
if not node:
1414
return
1515

1616
dfs(node.left)
17-
k_ans[0] = k_ans[0] - 1
17+
count[0] = count[0] - 1
1818

19-
if k_ans[0] == 0:
19+
if count[0] == 0:
2020
ans[0] = node.val
2121

2222
if k > 0:

0 commit comments

Comments
 (0)