leetcode1103

Posted asenyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode1103相关的知识,希望对你有一定的参考价值。

 1 class Solution:
 2     def distributeCandies(self, candies: int, num_people: int) -> List[int]:
 3         res = [0] * num_people
 4         t = 0
 5         while candies >= 0:
 6             for i in range(num_people):
 7                 t += 1
 8                 if candies >= t:
 9                     res[i] += t
10                     candies -= t
11                 else:
12                     res[i] += candies
13                     return res
14         return res
15             
16         

 

以上是关于leetcode1103的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode --- 1103. Distribute Candies to People 解题思路

LeetCode.1103-向人们分发糖果(Distribute Candies to People)

LeetCode——1103. 分糖果 II

Leetcode 1103. Distribute Candies to People

Leetcode 1103. Distribute Candies to People

Leetcode 1103. Distribute Candies to People