Pergunta de entrevista da empresa Anonymous

Programming problem solved at home and extensively discussed during technical interview.