The expected space complexity for this question is O(height of tree), but I am getting O(n) solution. I have seen people using inorder traversal to do this , but that too takes O(n) space…PLEASE HELP

Problem Link : Find a pair with given target in BST | Practice | GeeksforGeeks