run-time error - https://ide.codingblocks.com/s/60579
Print BST key In the Given range
Hi Prakhar, the array given in the input is not the preorder traversal of the BST to be formed. It is just a random unsorted array and you need to create a BST from the given unsorted array. I have modified the function to build tree and the code is now working fine. Rest of your logic was correct.
You can refer to the code here:
https://ide.codingblocks.com/s/60730