abhilashmnair / HacktoberFest2021

Beginner-friendly repository for Hacktober Fest 2021. Start your contribution to open source through baby steps. 💜
MIT License
30 stars 147 forks source link

Added Couples-Holding-Hands in CPP #232

Closed 0xamitdutta closed 3 years ago

0xamitdutta commented 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.