added problem 3 solution in ruby.