problem
1103. Distribute Candies to People
solution:没看明白代码。。。
class Solution { public: vector<int> distributeCandies(int candies, int num_people) { vector<int> res(num_people); for(int i=0; candies>0; candies-=++i) res[i%num_people] += min(i+1, candies); return res; } };
参考
1. Leetcode_easy_1103. Distribute Candies to People;
2. Discuss;
完