Most Candy Types
The candies are split equally, but the sister wants to try as many different types as possible. Given a list candy_type, where each number represents a candy type, the sister receives exactly half of all candies. Return the maximum number of different candy types she can get.
Примеры
Ввод
[1, 1, 2, 2, 3, 3]Вывод
3Ввод
[1, 1, 2, 3]Вывод
2Ввод
[6, 6, 6, 6]Вывод
1Нужно реализовать
def distribute_candies(candy_type: list[int]) -> int:
Теги
arraysethashmap
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediVisible tests
1
Input
[1,1,2,2,3,3]Expected
32
Input
[1,1,2,3]Expected
23
Input
[6,6,6,6]Expected
14
Input
[1,2,3,4,5,6]Expected
35
Input
[1,1,1,1,2,2,2,2]Expected
26
Input
[0,0,0,0]Expected
1Focus radio
Paused · SomaFM · Fluid