How many are at most, many times

A code exercise of about 20 minutes: read the statement, solve «How many are at most, many times» in the browser and get a review like in a real interview.

Code · 20 min
Loading…

Statement

Write countAtMost(sorted, queries): sorted is in ascending order (it may have repeats). For each number in queries, count how many items of sorted are less than or equal to it. Return the list of counts. Both lists can hold tens of thousands of numbers.