Leetcode Binary tree from inorder and preorder

I am really confused where I have made Mistake in code can u plz help
problem https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/

my code>> https://ide.codingblocks.com/s/571483

@joshisanjay8467 you have defined j earlier and using same for required position but inside for loop you have defined a new variable j {for(int j …)} so your previous defined j was never getting updated.
just don’t define j again inside for loop and it will work fine.

my bad didnt saw thankyou bhaiya

1 Like

if you have any further queries let me know else mark this doubt as resolved.

1 Like

Problem https://www.interviewbit.com/problems/sorted-permutation-rank/

my code is failing on Large test cases and I tried but couldn’t correct it plz help
my code>> https://ide.codingblocks.com/s/571863
I already created new doubt for this problem but nobody responded!!!

You can mark the doubt as resolved now. I already answered on that thread.

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.