You are viewing a single comment's thread. Return to all comments →
public static void countApplesAndOranges(int s, int t, int a, int b, List apples, List oranges) { int appleCount = 0; int orangeCount = 0;
for(int appleDistance : apples){ int applePosition = a + appleDistance; if(s <= applePosition && applePosition <= t){ appleCount++; } } for(int orangeDistance : oranges){ int orangePosition = b + orangeDistance; if(s <= orangePosition && orangePosition <= t){ orangeCount++; } } System.out.println(appleCount); System.out.println(orangeCount); }
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 →
public static void countApplesAndOranges(int s, int t, int a, int b, List apples, List oranges) { int appleCount = 0; int orangeCount = 0;