Getting segmentation fault

The issue is in your longestbst function. Also you are not taking input

for(int i=0;i<n;i++)
	{
        cin>>pre[i];
	}
	for(int i=0;i<n;i++)
	{
        cin>>ino[i];
	}

Try to correct you code. Instead of your int_min initialisation do 0. Try to correct on your own if it doesn’t pass let me know. I’ll help.

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.