• + 0 comments

    My JS solution:

    function countApplesAndOranges(s, t, a, b, apples, oranges) {
        console.log(
            apples
                .map(apple => apple + a)
                .filter(apple => apple >= s && t >= apple).length
            );
        console.log(
            oranges
                .map(orange => b + orange)
                .filter(orange => orange <= t && orange >= s).length
            );
    }