N couples sit in 2N seats arranged in a row. You want every couple to sit side by side. Couples are numbered (0,1), (2,3), etc. A swap consists of choosing any two people and having them swap seats. Return the minimum number of swaps so that every couple is sitting side by side.
30:00
Java
Couples Holding Hands
hard
Topics
Companies
N couples sit in 2N seats arranged in a row. You want every couple to sit side by side. Couples are numbered (0,1), (2,3), etc. A swap consists of choosing any two people and having them swap seats. Return the minimum number of swaps so that every couple is sitting side by side.