Principal Financial Group's QA automation may receive a shuffled set of card identities representing a physical card-checking process. There are 103 face-down cards: 51 card identities appear exactly twice, and one identity appears exactly once. You may reveal only one card at a time.
Implement find_odd_card(cards) to return the unpaired card identity and the minimum number of flips required to guarantee finding it. Because an unseen card could still be the missing match, the algorithm must provide a worst-case guarantee rather than stopping when a candidate first appears.
cards, a list of integers containing 2k + 1 values. Every value appears exactly twice except one value, which appears once.[odd_card, flips], where odd_card is the value appearing once and flips is the minimum number of cards that must be revealed in the worst case.k = 51, so there are 103 cards.def find_odd_card(cards):