We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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++;
}
}
Apple and Orange
You are viewing a single comment's thread. Return to all comments →