Create tree using inorder and preorder

first two test cases show wrong answer plz check the code and do the changes and let me know the mistake.

problem : https://online.codingblocks.com/app/player/39658/content/55448/4974/code-challenge?code=y6428slObFnnjwlKSRcKtqKAbWKG5prg

code : https://ide.codingblocks.com/s/195799

plz reply ASAP

@sengarankit98
hello ankit,
remove r+=1 from line no 34.
rest evrythng is correct

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.