Can anyone help me out here…My solution is still getting WA for some test cases.
I have paired minsetA with all values of setB to get |B| values. Further I have paired maxSetB with all values of setA but first_(minsetA)_ hence getting another |A|-1 values, original indices have also been maintained.
For the editorial solution to work, either sequence A or sequence B should be unique. But no where in the problem it was mentioned or is it mentioned in the problem?
@manasi2399 You don’t need to use container except vector that too for storing the sequence. Read the problem statement carefully. Although people have already gave an idea about how you can solve the problem easily with just a small observation.