This code is giving segmentation fault

My code URL is :-https://ide.codingblocks.com/s/652881

Plz correct the mistake in the code.

hi @chhabrarishi2001_264ecb7697e8af2a
there is issue with input u are taking… there is no -1 there…
also ur buildtree function was not correct…
corrected code -->


It’s working fine and passing all test cases…

@chhabrarishi2001_264ecb7697e8af2a
I hope it’s clear now???

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.