O02

Minimum Starting Inventory

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: NUMERIC

Problem Statement & Objective

Determine the minimum initial warehouse stock needed so inventory never drops below zero given daily demand.

Function Signature (Python)

minimum_starting_inventory(moves: list[int]) -> int

Input & Output Contract

Output Rule:Negatif olmayan en küçük tam sayı. Liste boşsa 0. Stok hiç eksiye düşmüyorsa 0.

System Constraints

0 <= hareketler.length <= 10^5
-10^6 <= hareketler[i] <= 10^6

Example Execution Walkthrough

hareketler = [3, -5, 2, -1]
başlangıç 0 kabul edilirse gün sonu bakiyeleri: 3, -2, 0, -1
en düşük bakiye -2 -> bunu 0'a çıkarmak için +2 gerekir
cevap: 2

Example Test Scenarios (3)

Example 1
Input:[[3,-5,2,-1]]
Expected Output:2
Example 2: Başta Negatif Düşüş
Input:[[-1,-1,-1,5]]
Expected Output:3
Example 3: Pozitif Başlangıç
Input:[[10,-5,-3,2]]
Expected Output:0
Loading Python Editor...
Input Parameters
[
  [
    3,
    -5,
    2,
    -1
  ]
]
Expected Output
2