Max heap in o(n) implementation

not getting the correct output for this case.

Hey @guptashubham210a, you don’t need to increase the value of static variable preindex, twice(line 29 and line 31).
Instead, you can do it only once while making the root.
Another problem that you might encounter(not in this test case) is making a map for checking the index in inorder array when there are multiple occurrences of pre[preindex] in inorder, we just have to look for pre[preindex] in inorder array in the range of start to end. You can check it here.
HINT: You can do it by vector.find(inorder.begin()+st,inorder.begin()+end,pre[preindex]) in STL directly.