CS questions solved in ruby