In my submission, I have not considered the number of testcases and the key. I just wanted to execute the first part i.e. printing the preOrder of the given BST but I am not getting the correct preOrder output. Please check my code and suggest me what corrections should be made.
Not getting the desired output
Is anyone assigned to solve my doubt?
Hey @Syed-Siddiqui-2497215583854102
perorder code is fine
just a change
nn.left = construct(arr, lo, mid - 1); // instead of nn.left = construct(arr, 0, mid - 1);
In this Question, Don’t use Inorder travelers for tree Build (because in some case root node is change)
just Add Node manually