• + 0 comments

    public static void countApplesAndOranges(int s, int t, int a, int b, List apples, List oranges) { // Write your code here int noOfApple = 0; for(Integer ap: apples){ int dist = ap+a; if(dist >= s && dist<=t){ noOfApple++; } } int noOfOrange = 0; for(Integer or: oranges){ int dist = or+b; if(dist >= s && dist<=t){ noOfOrange++; } }

        System.out.println(noOfApple);
        System.out.println(noOfOrange);
    }````