Created
May 20, 2020 12:49
-
-
Save kunal768/dfb93957c156be757da3011fec0e09a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def kthSmallest(self, root: TreeNode, k: int) -> int: | |
arr = [] | |
def inorder(root,arr): | |
if root.left : | |
inorder(root.left,arr) | |
if root : | |
arr.append(root.val) | |
if root.right : | |
inorder(root.right,arr) | |
inorder(root,arr) | |
return arr[k-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment