This is a verified interview question from Linkedin. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Design a Stack With Increment Operation - Linkedin Online Assessment IIT Kanpur" covers key patterns like Other.
"You are given an initially empty stack that supports the following operations: * `push x` - Push the integer `x` onto the top of the stack. * `pop` - Remove the top element of the stack. * `inc k v` - Add `v` to each of the bottom `k` elements of the stack. After performing each operation, print the value at the top of the stack. If the stack becomes empty, print "EMPTY" instead. It is guaranteed that: * `pop` is never called on an empty stack. * `1 <= i <= current size of stack` whenever an `inc` operation is performed. ### Input Format The first line contains an integer `n` - the number of operations. Each of the next `n` lines contains one operation in one of the following formats: * `push x` * `pop` * `inc i v` ### Output Format After every operation, print the value at the top of the stack on a new line. If the stack is empty, print EMPTY. Example Input 5 push 4 push 5 inc 2 1 pop pop Output 4 5 6 5 EMPTY  This is the small sample ."
Join thousands of developers practicing for Linkedin.