From what I read here, child scope should have access to variables defined in the parent scope. However, in my case, I get an unresolved error on count
. Any reason why this happened?
def find_kth_largest_bst(root, k):
count = 0
def _find_kth_largest_bst(root, k):
if not root:
return None
_find_kth_largest_bst(root.right, k)
count += 1 #unresolved error here??
pass