Pregunta de entrevista de IBM

It was an online coding round.