Pergunta de entrevista da empresa headstrait

The Josephus Problem Program question