2024-06-03发表2025-01-15更新LeetCode每日一题几秒读完 (大约68个字)0次访问1103. 分糖果 II分糖果 II 难度: easy 原始链接: https://leetcode.cn/problems/distribute-candies-to-people 标签: 模拟 解法一: 哈希go12345678func distributeCandies(candies int, num_people int) []int { ans := make([]int, num_people) for i := 0; candies > 0; i++ { ans[i%num_people] += min(i+1, candies) candies -= i + 1 } return ans} 1103. 分糖果 IIhttps://wuhunyu.top/leetcode/2024/06/distribute-candies-to-people/index.html作者wuhunyu发布于2024-06-03更新于2025-01-15许可协议#模拟