You are viewing a single comment's thread. Return to all comments →
Here is muy C# solution
public static void countApplesAndOranges(int s, int t, int a, int b, List<int> apples, List<int> oranges) { Console.WriteLine(apples.Select(x => calculateRange(a, s, t, x)).Sum()); Console.WriteLine(oranges.Select(x => calculateRange(b, s, t, x)).Sum()); } public static int calculateRange(int localtedTree, int localtedHomeS, int localtedHomeT, int fruit) =>((localtedTree + fruit) >= localtedHomeS && (localtedTree + fruit) <= localtedHomeT) ? 1 : 0;
Seems like cookies are disabled on this browser, please enable them to open this website
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
Here is muy C# solution