Add Ruby solution to problem 3.