Company: Linkdein/Hakerank_24july
Difficulty: medium
Implement a special stack (a "Super Stack") that processes a sequence of commands. The stack starts empty. Each command is one of the following: push v — Push the integer v onto the top of the stack. pop — Remove the element currently on top of the stack. inc i v — Add the value v to each of the bottom i elements of the stack (the i elements closest to the bottom). After processing each command, print the value currently on top of the stack on its own line. If the stack is empty at that moment, print the string EMPTY instead. Input Format The first line contains a single integer n , the number of commands. Each of the next n lines contains one command in exactly one of these forms: - push v - pop - inc i v Output Format Print n lines. After the k -th command, print the value on top of the stack, or EMPTY if the stack is empty at that point. Example Input: 5 push 4 push 5 inc 2 1 pop pop Output: 4 5 6 5 EMPTY Explanation (top of the stack is shown rightmost): 1. push 4 → stack