β back to unit
Medium
# sorting medium
Spot the Doubles
Two kids brought the same trading card β after sorting the pile, identical cards stand RIGHT NEXT to each other. π
You get a list of cards (numbers). Print every value that appears more than once, each printed once, smallest first, separated by spaces β or no doubles.
Example:
Input: cards = [7, 3, 7, 1, 3]
Output: 3 7
Sorted, the list becomes [1, 3, 3, 7, 7] β the duplicate 3s and 7s sit right next to each other, reported smallest first.
π‘ need a hint?
sort-spot-the-doubles.pyπ given lines are locked β write your code in between
loading...