Problem is this: https://leetcode.com/problems/two-sum-iv-input-is-a-bst/
Initial solutions using map or a set were easy to come up with but interviewer wanted O(1) space complexity
where the space for the recursion stack is not counted.
Interviewer allowed for the Node to be structured however I wanted so it could have a parent reference for example.
For example the node class could be something like:
class Node {
Node parent;
Node left;
Node right;
int val;}
From this point two pointer method was used but I got a bit nervous and couldnt finish the implementation. Can someone help me complete this? Two pointer method with an array was a bit easier for me to grasp than with a bst.