Drill

ProblemsC# › logistics

When does the order actually arrive

mediumlogisticsMathSimulationC#

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.

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.

Solve it in Python →

Where you start

public int DeliveryEta(int processingDays) {
    
}

Worked examples

CallResult
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;
}

The same problem in another language

More logistics problems in C#