Codility challenges solved in ruby