Prateek sir and coding

Can you please explain this problem. I am not able to understand.

Hello @mikkyimran,

In this question, you have to handle two types of inputs (i.e. two types of queries)

You need to maintain a stack(i.e. pile) of code modules:
When the input is 1:
you have to assign the code module present at the top of the stack to the student.
i.e. you have to print the value(i.e. the cost of the module) present at the top of the stack and pop that value out of the stack.
When the input is 2:
you have to add the value(i.e. the cost of module following the input 2) into(i.e. at the top of) the stack.

Special case:
When the stack is empty and the input is 1.
As there is no module present to assign to the student.
So, print “No Code”

Hope, this would help.
Give a like if you are satisfied.