Skip to content

Instantly share code, notes, and snippets.

View Nasah-Kuma's full-sized avatar

Mantoh Nasah Kuma Nasah-Kuma

View GitHub Profile
function countApplesAndOranges(s, t, a, b, apples, oranges) {
// Write your code here
let applesOnHouse = 0;
let orangesOnHouse = 0;
const applesDistancesFromTree = apples.map((apple) => apple+a);
const orangesDistancesFromTree = oranges.map((orange) => orange+b);
applesDistancesFromTree.forEach((appleDistance) => {
if(appleDistance >= s && appleDistance <= t) applesOnHouse++;
})
orangesDistancesFromTree.forEach((orangeDistance) => {
function getTotalX(a, b) {
// Write your code here
let lowerBoundInt = a[a.length - 1];
let upperBoundInt = b[0];
let arrayInt = [];
let arrayForFactorsOfA = [];
let arrayWhoseFactorsAreB = [];
let finalArr = [];
if(lowerBoundInt > upperBoundInt) {