Closed 0xamitdutta closed 3 years ago
There are n couples sitting in 2n seats arranged in a row and want to hold hands. Return the minimum number of swaps so that every couple is sitting side by side. A swap consists of choosing any two people, then they stand up and switch seats.
There are n couples sitting in 2n seats arranged in a row and want to hold hands. Return the minimum number of swaps so that every couple is sitting side by side. A swap consists of choosing any two people, then they stand up and switch seats.