Count builds in range

Write codeEasy16 min

Your task

A deploy log records every rollout to production in build order, so builds is sorted ascending and holds nonnegative build numbers. One build number can appear several times, because a build reaches one region at a time and each region logs its own record. A release report asks the log a batch of range questions. lows and highs have the same length, and query k asks how many records carry a build number strictly between lows[k] and highs[k]: above the low and below the high, with both endpoints excluded, so a record on either endpoint is not counted. Return one count per query, in the order asked. A query whose high is at or below its low describes nothing and answers 0, and an empty log answers 0 for every query. When no queries are asked, return an empty list. The log holds years of rollouts, so halve it per query rather than counting records one at a time.

Examples

count_deploys_between(builds: list[int], lows: list[int], highs: list[int]) -> list[int]
Example 1
Inputcount_deploys_between([1041, 1041, 1055, 1055, 1055, 1090, 1104], [1041, 1040, 1041], [1090, 1042, 1055])
Output[3, 2, 0]
Example 2
Inputcount_deploys_between([10, 10, 12, 15, 15, 15, 20, 31], [9, 10, 15, 30, 0], [11, 20, 15, 40, 100])
Output[2, 4, 0, 1, 8]