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
long ab = apples.stream().map(n->n+a).filter(n->(n>=s && n<=t)).count();
System.out.println(ab);
long bc = oranges.stream().map(n->n+b).filter(n->(n>=s && n<=t)).count();
System.out.println(bc);
}
Cookie support is required to access HackerRank
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) { // Write your code here long ab = apples.stream().map(n->n+a).filter(n->(n>=s && n<=t)).count(); System.out.println(ab); long bc = oranges.stream().map(n->n+b).filter(n->(n>=s && n<=t)).count(); System.out.println(bc); }