Pregunta de entrevista de CoreFlex Solutions

Coding question in Java not in any other language