MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / Solution

Class Solution

Tree/KthSmallestElementInABST.py:59–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57# self.right = None
58
59class Solution:
60
61 def find_data(self, root: TreeNode):
62
63 if root is None:
64 return
65 Solution.find_data(self,root.left)
66 self.data.append(root.val)
67 Solution.find_data(self,root.right)
68 return
69
70 def kthSmallest(self, root: TreeNode, k: int) -> int:
71 self.data = []
72 Solution.find_data(self, root)
73 return self.data[k-1]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected