Pergunta de entrevista da empresa HackerEarth

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