add problem 24 to ruby