2024-06-02发表2025-01-15更新LeetCode每日一题几秒读完 (大约62个字)0次访问575. 分糖果分糖果 难度: easy 原始链接: https://leetcode.cn/problems/distribute-candies 标签: 哈希 解法一: 哈希go12345678func distributeCandies(candyType []int) int { n := len(candyType) typeHash := make(map[int]bool) for i := 0; i < n; i++ { typeHash[candyType[i]] = true } return min(n>>1, len(typeHash))} 575. 分糖果https://wuhunyu.top/leetcode/2024/06/distribute-candies/index.html作者wuhunyu发布于2024-06-02更新于2025-01-15许可协议#哈希