When does the order actually arrive
Fulfilment ships on business days only — Saturday and Sunday never move a parcel. Estimate the calendar day an order placed on day 0 reaches the door after processingDays of travel.
- Day 0 is a Monday, and the parcel sets off the next business day.
- One business day (Mon–Fri) is consumed per day of travel; weekends do not count.
- Return the calendar day, counted from day 0, on which the last travel day ends.
- processingDays of zero still ships on the next business day.
DeliveryEta(processingDays: int) → int
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 int DeliveryEta(int processingDays) {
}
Worked examples
| Call | Result |
|---|---|
DeliveryEta(1) | 1 |
DeliveryEta(2) | 2 |
DeliveryEta(5) | 7 |
DeliveryEta(6) | 8 |
Hint
Walk day by day; each business day consumed advances the done count, and only stop once it matches processingDays.
Reference solution in C#
public int DeliveryEta(int processingDays) {
int day = 1, done = 0;
while (done < processingDays) {
if (day % 7 < 5) done++;
if (done < processingDays) day++;
}
return day;
}