Pregunta de entrevista de Boats Group

Recursion based question in Java.