Ładowanie zadania…
After laundry, socks need to be matched into pairs of the same color. The function sock_merchant receives the number of socks n and a list of colors ar, where equal numbers mean the same color. Count how many complete pairs can be made. A leftover sock without a pair does not count.
9, [10, 20, 20, 10, 10, 30, 50, 10, 20]31, [1]04, [1, 1, 1, 1]2def sock_merchant(n: int, ar: list[int]) -> int:
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj się9, [10,20,20,10,10,30,50,10,20]31, [1]04, [1,1,1,1]26, [1,1,2,2,2,2]30, []01000, [10,20,20,10,10,30,50,10,20,10]3