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; }
bool reachNextLevel(int experience, int threshold, int reward) { return experience + reward >= threshold; }
int phoneCall(int min1, int min2_10, int min11, int s) { var min = 0; while (s > 0) { if (min == 0) { if (s >= min1) { s -= min1; min = 1; } else s = 0; } else if (min == 1) { if (s >= min2_10 * 9) { min = 10; s -= min2_10 * 9; } else if (s < min2_10) { min = 2; s = 0; } else { min += s / min2_10; s = 0; } } else if (min == 10) { if (s < min11) min++; else min += s / min11; s = 0; } } return min; }
int lateRide(int n) { return (n / 60) / 10 + (n / 60) % 10 + (n % 60) / 10 + (n % 60) % 10; }
int circleOfNumbers(int n, int firstNumber) { return (firstNumber + n / 2) % n; }
int maxMultiple(int divisor, int bound) { return (bound / divisor) * divisor; }
int seatsInTheater(int nCols, int nRows, int col, int row) { return (nCols - col + 1) * (nRows - row); }
int candies(int n, int m) { return m / n * n; }