Create tree using pre in in- order

https://ide.codingblocks.com/s/307125 im getting runtime error in tescase number 2 and 3, plz mark bug in my code

you have to pass idx by reference
otherwise changes will not reflect in next function call

Modified Code

now it will pass all test case