sweets[i]; equal numbers mean the same flavor.
You decide to eat exactly half the box, n / 2 sweets, and want to try as many different flavors as possible. Return the largest number of distinct flavors you can get.sweets=[4, 4, 4, 7, 7, 2] → 3
You can take 3 sweets, and there are exactly three flavors: 4, 7 and 2.
sweets=[1, 2, 3, 4, 5, 6, 7, 8] → 4
Every flavor is different, but only 4 sweets may be taken, so 4 flavors.
sweets=[-3, -3] → 1
sweets=[4, 4, 4, 7, 7, 2]
3
Run checks the first 3 tests in your browser. Submit checks all 100 tests on the server, hidden ones included.