Pergunta de entrevista da empresa Boats Group

Recursion based question in Java.