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         

 

上一篇:Oracle 11g listener.ora原文件


下一篇:[LeetCode] 101. 对称二叉树