Pergunta de entrevista da empresa MWR InfoSecurity

Solve an algorithm in Ruby