Array to balanced bst

question–>
https://practice.geeksforgeeks.org/problems/array-to-bst/0#

code–>


Not passing all testcases

Hello @sheikhhaji18 where you are trying to submit it on gfg or hackerblocks?

geeks for geeks @tusharaggarwal272

@sheikhhaji18 okay wait i will check the code.
please wait till then.

i also have a small doubt what is maximum size of array that we can allocate in statically in main and globally?

you can declare 1e7 in main.
beyond that you should declare it globally.

i was allocating 10^6 ,it started giving error

i figured out i was doing siilly mistake like k-1 instead of n-1 , i printed the inorder instead of preorder

@sheikhhaji18 if your doubt is cleared please mark this doubt as resolved.
Happy Learning!!