Algorithm · Square · Medium
You are handed a list of people. Split the whole group into pairs and return those pairs, so that each person ends up matched with one, and only one, other person from the list. Every person must appear in exactly one pair in the result, and nobody may be paired with themselves. Follow-ups The function may be invoked repeatedly on the same list. Extend it so that each repeated call produces a pairing different from the ones returned before. Modify the solution so that the…