I have analysed this problem and have attempted this problem but haven’t solved it yet. I need some deep insight how to tackle questions of this pattern and get the right intuition.
Till now what I have understood from the problem:-
- There are many sequences of data that may lead to same BST.
- In all sequences the root node must appear before it’s child so as to maintain relative order of nodes.
- We could do this problem recursively as we can see for each node it have two choices:
i) start with left sequence
ii) start with right sequence
- We can generate combinations of these sequences
I am stuck in how to do these, how can I generate and validate my sequence
Thanks in advance :’)