return "short";
}
if (s.Length >= 4 && s.Length <= 7){
return "average";
}
if(s.Length >= 8 && s.Length <= 14){
return "long";
}
return "super long";
5.02 - thx
if (i % 1111 == 0) return "fancy year";
return "not a fancy year";
5.04 - if (y > 0 && x < 0){
return (x-y) - 2*(x-y);
}
if (x > 0 && y < 0){
return (x-y);
}
if ((x+y) < 0){
return (x+y) - 2*(x+y);
}
return x + y;
5.05 - return (j == i*i)
There's an easier solution for 5.02:
ReplyDeletepublic static String Puzzle(int i) {
if (i % 1111 == 0) return "fancy year";
return "not a fancy year";
}
Shorter solution for 5.05:
ReplyDeletereturn j==i*i;
5.01 (s.Length <= 3 ? "short" : s.Length <= 7 ? "average" : s.Length <= 14 ? "long" : "super long")
ReplyDelete5.02 (i % 1111 == 0 ? "fancy year" : "not a fancy year")
5.03 (a*a+b*b==c*c || a*a+c*c==b*b || b*b+c*c==a*a)
5.04 Math.Abs(x)+Math.Abs(y)
5.05 (j == i*i)