Drill

ProblemsPython › logistics

How many parcels missed the van

easylogisticsPython

Items boarded the van if their ready time is before backstopMinutes. Count how many missed it, so the leftover list can be quoted again.

late_parcels(ready_times: list<int>, backstop_minutes: int) → int

Solve it in the editor →

Where you start

def late_parcels(ready_times: list[int], backstop_minutes: int) -> int:
    

Worked examples

CallResult
late_parcels([100, 200, 300], 250)1
late_parcels([250, 250], 250)0
late_parcels([300], 100)1
late_parcels([], 500)0

Hint

Count the ones that fail the comparison.

Reference solution in Python
def late_parcels(ready_times: list[int], backstop_minutes: int) -> int:
    return sum(1 for t in ready_times if t > backstop_minutes)

The same problem in another language

More logistics problems in Python