omggg's blog

By omggg, 3 years ago, In English

Here is the reference problem

What If I have upto N numbers instead of 0 and 1 only and I want to group all of them separately?

Eg. [1,2,3,2,1,4,3] — > [1,1,3,3,2,2,4]

How to solve this for minimum swaps ?

Any help is much appreciated, THanks :)

  • Vote: I like it
  • +7
  • Vote: I do not like it