Pergunta de entrevista da empresa KPMG

Problem of looping, pattern problems