You are viewing a single comment's thread. Return to all comments →
This is mine, with LINQ
static bool Between(int num, int lower, int upper) { return lower <= num && num <= upper; } static void countApplesAndOranges(int s, int t, int a, int b, int[] apples, int[] oranges) { int a_point = apples.Count(val => Between(a + val, s, t)); int b_point = oranges.Count(val => Between(b + val, s, t)); Console.WriteLine(a_point); Console.WriteLine(b_point); }
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
This is mine, with LINQ