int[] metroCard(int lastNumberOfDays) { return lastNumberOfDays == 28 || lastNumberOfDays == 30 ? new [] { 31 } : new [] { 28, 30, 31 }; }
Previous Next
int[] metroCard(int lastNumberOfDays) { return lastNumberOfDays == 28 || lastNumberOfDays == 30 ? new [] { 31 } : new [] { 28, 30, 31 }; }
bool willYou(bool young, bool beautiful, bool loved) { return (young && beautiful && !loved) || ((!young || !beautiful) && loved); }
bool tennisSet(int score1, int score2) { return (Math.Min(score1, score2) < 5 && Math.Max(score1, score2) == 6) || ((Math.Min(score1, score2) == 5 || Math.Min(score1, score2) == 6) && Math.Max(score1, score2) == 7); }
bool arithmeticExpression(int A, int B, int C) { return A + B == C || A - B == C || A * B == C || A / B == C && A % B == 0; }
bool isInfiniteProcess(int a, int b) { return a > b || Math.Abs(a - b) % 2 == 1; }
int extraNumber(int a, int b, int c) { return (a == b) ? c : (a == c) ? b : a; }
int knapsackLight(int value1, int weight1, int value2, int weight2, int maxW) { if (weight1 + weight2 <= maxW) return value1 + value2; else if (weight1 > maxW && weight2 > maxW) return 0; else if (weight1 > maxW) return value2; else if (weight2 > maxW) return value1; else return value1 > value2 ? value1 : value2; }