Domanda di colloquio di HackerEarth

A normal stack-based problem, if you have done competitive programming it would be very easy for you.