Company: Netradyne_29oct
Difficulty: medium
Chocolate stack Problem Description A shop has a stack of chocolate boxes each containing a positive number of chocolates. Initially, the stack is empty. During the next N minutes, either of these two things may happen: The box of chocolates on top of the stack gets sold You receive a box of chocolates from the warehouse and put it on top of the stack. Determine the number of chocolates in the sold box each time he sells a box. Notes If C[i] = 0, he sells a box. If C[i] > 0, he receives a box containing C[i] chocolates. It is confirmed that he gets a buyer only when he has a non-empty stack. The capacity of the stack is infinite. Function Description Complete the solve() function provided in the editor. The function takes the following 2 parameters and returns the solution. N: Represents the number of minutes C: Represents the description of boxes Input Format Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boiler