```
def kthSmallest(self, root, k):
res=[0]
def recur(root, k):
if not root:
return 0
left_num=recur(root.left, k)
if left_num==k-1:
res[0]=root.val
return 1+left_num+recur(root.right, k-1-left_num)
recur(root, k)
return res[0]
```