Problems › JavaScript › logistics
Is the order inside the same-day window
A city courier offers same-day delivery for orders placed by a cutoff hour. Orders have a leadTime of minutes; return whether the order still makes the window.
- Give the answer for an order where leadTime minutes remain before the cutoff expires.
- Any remaining leadTime of at least 1 minute is still enough — the cutoff is inclusive.
sameDayWindow(leadMinutes: int, cutoffMinutes: int) → bool
Where you start
function sameDayWindow(leadMinutes, cutoffMinutes) {
}
Worked examples
| Call | Result |
|---|---|
sameDayWindow(30, 60) | true |
sameDayWindow(60, 60) | true |
sameDayWindow(61, 60) | false |
sameDayWindow(90, 0) | false |
Hint
Compare two integers.
Reference solution in JavaScript
function sameDayWindow(leadMinutes, cutoffMinutes) {
return leadMinutes <= cutoffMinutes;
}