• + 0 comments

    This is my approach:

    function countApplesAndOranges(s, t, a, b, apples, oranges) {
        // Write your code here
        let counter = [0,0];
            
        apples.map(ap=>{
            if(((ap+a)>=s)&&((ap+a)<=t)) counter[0] ++;
        })
        oranges.map(or=>{
            if(((or+b)>=s)&&((or+b)<=t)) counter[1] ++;
        })
        return console.log(counter.join('\n'));
    }