When to reorder a part
Purchasing wants the stock level at which a part should be reordered, so it arrives before the shelf runs dry.
- Cover the daily usage for the whole lead time, then add the safety stock on top.
- Any negative input is bad data — treat it as zero.
reorder_point(daily_use: int, lead_days: int, safety: int) → int
Where you start
def reorder_point(daily_use: int, lead_days: int, safety: int) -> int:
Worked examples
| Call | Result |
|---|---|
reorder_point(10, 3, 5) | 35 |
reorder_point(0, 7, 20) | 20 |
reorder_point(12, 0, 0) | 0 |
reorder_point(-5, 3, 10) | 10 |
Hint
dailyUse × leadDays + safety, with each input floored at zero first.
Reference solution in Python
def reorder_point(daily_use: int, lead_days: int, safety: int) -> int:
return max(0, daily_use) * max(0, lead_days) + max(0, safety)