Distribute Candies to People
We distribute some number of candies c to a row of n people in the following way:
We then give 1 candy to the first person, 2 candies to the second person, and so on until we give n candies to the last person.
Then, we go back to the start of the row, giving n+1 candies to the first person, n+2 candies to the second person, and so on until we give 2n candies to the last person.
This process repeats (with us giving one more candy each time until no more candies are left).
Return an array (of length n) that represents the final distribution of candies.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)