Pregunta de entrevista de Olympusat

It was a scenario based and asked to code the test case