• + 0 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;