解题思路:
1、采用两次循环,一层循环使用while,二层循环根据数组进行赋值,整体的算法不算太复杂。
2、注意数组是累积相加(开始时直接写成了赋值出现问题),末尾数值的处理需要注意。
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* distributeCandies(int candies, int num_people, int* returnSize){
int *a = (