You are viewing a single comment's thread. Return to all comments →
JS easy solution:-
function countApplesAndOranges(s, t, a, b, apples, oranges) { const fallingFrutes = (startPoint, frutes) => { return frutes.reduce((acc, frute) => { const position = startPoint + frute; if (position >= s & position <= t) acc++; return acc; }, 0) } const appleFallsOnHouse = fallingFrutes(a, apples) console.log(appleFallsOnHouse); const orangesFallsOnHouse = fallingFrutes(b,oranges) console.log(orangesFallsOnHouse); }
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 →
JS easy solution:-