In** problem E** of yesterday's round, I misread the question and thought of a completely different problem the whole time. But this problem might also be interesting for some of you guys. So, here goes the modification:- Instead of swapping any two elements, you can swap only two adjacent elements and the constraint on m is m<=n.
I can share my idea and code also for this problem which I think works. Meanwhile, if any of you guys know any links where we can submit this problem, please share it.
Thanks for reading.
Auto comment: topic has been updated by Fearless_cod (previous revision, new revision, compare).
Auto comment: topic has been updated by Fearless_cod (previous revision, new revision, compare).
I also did the same misread, the problem was nice that way too :)
since all element are distinct, no of adjacent swaps required to convert array A to array B, can be done using counting inversions on the modified array A' (A' can be calculated by array A and B)