Question: 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,

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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!