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.
int applesOnHouse = 0;
for (int i = 0; i < apples.length; i++) {
int applePosition = a + apples[i];
if (applePosition >= s && applePosition <= t) {
applesOnHouse++;
}
}
System.out.println(applesOnHouse);
int orangesOnHouse = 0;
for (int i = 0; i < oranges.length; i++) {
int orangePosition = b + oranges[i];
if (orangePosition >= s && orangePosition <= t) {
orangesOnHouse++;
}
}
System.out.println(orangesOnHouse);
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 →
Here you go: