the problem is an image so I'll try to abbreviate and write it out:
there are 2 football teams. For every match of team B compute the total number of matches that team A has scored less than or equal to team B in that match. For example:
team A : [2,3,4]
team B : [3,5]
the output will be : [2,3]
my solution so far:
function counts(teamA, teamB) {
var arr = []
for (var i = 0; i < teamB.length; i++){
let newArr = teamA.filter(some => some <= teamB[i])
arr.push(newArr.length)
}
return arr
}
Only some test cases pass (can't see what isn't passing). Any thoughts as to what I'm missing here?
edit: Here is another test case as an example: