Philips interview question

Stack algorithm ,how does it work