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
C# needs a compiler and Drill does not host one yet, so this page is the reference rather than an exercise: the problem, worked examples, and the solution in full. To type it out, the same problem runs in Python.
Where you start
public bool SameDayWindow(int leadMinutes, int 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 C#
public bool SameDayWindow(int leadMinutes, int cutoffMinutes) {
return leadMinutes <= cutoffMinutes;
}