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
PostgreSQLv16

Siia ilmub koodi käivituse tulemus

Visible tests
1
Input
[1,1,2,2,3,3]
Expected3
2
Input
[1,1,2,3]
Expected2
3
Input
[6,6,6,6]
Expected1
4
Input
[1,2,3,4,5,6]
Expected3
5
Input
[1,1,1,1,2,2,2,2]
Expected2
6
Input
[0,0,0,0]
Expected1
Focus radio
Paused · SomaFM · Fluid