MWR InfoSecurity interview question

Solve an algorithm in Ruby