luoheng
10/7/2019 - 6:26 AM

distributeCandies

func distributeCandies(candies []int) int {
    count := map[int]bool{}
    for _, c := range candies {
        count[c] = true
    }
    if len(candies)/2 < len(count) {
        return len(candies)/2
    }
    return len(count)
}