N-th Tribonacci Number
Real-world version: Three-Day Dispatch LadderThe statement here is our own: the same inputs, outputs and technique.
A courier depot keeps a daily log of how many vans it sent out, numbering days from 0.
The log opens with a quiet day: no vans left the yard on day 0. Exactly one van left on day 1, and exactly one left on day 2. From day 3 onward the depot's rule is fixed: the count for a day is the three counts of the days right before it added together.
Given a day number day, return the number of vans the log shows for that day.
Examples
Example 1
- Input
- day = 0
- Output
- 0
Day `0` is the quiet day the log opens with, so nothing left the yard.
Example 2
- Input
- day = 7
- Output
- 24
Days `4` through `6` show 4, 7 and 13 vans, and day `7` follows from those three.
Example 3
- Input
- day = 26
- Output
- 2555757
The counts climb quickly once the depot's rule takes over, and day `26` is a six-figure count.
Constraints
- 0 <= day <= 37
- The count for the requested day is guaranteed to fit in a signed 32-bit integer, so it is at most 2^31 - 1.
The signature
The editor starts with this. It matches the parent problem's shape, so a solution that works here works on a standard judge unchanged.
def vans_dispatched(day: int) -> int:public int vansDispatched(int day)Checking your plan…
How this problem was checked
- Passed: Reference solution run against 9 test cases: 9 passed
- Passed: 3 worked examples confirmed by running the code
- Passed: 0 eight-word sequences shared with the parent problem's text
- Passed: Agrees with an independent brute-force solution on random inputs
- Passed: Test set shown to catch deliberately broken solutions
- Passed: Reviewed by a separate quality pass
- Passed: Function arity matches the parent problem's