Problems > First Stockout Day > Editorial

First Stockout Day — Solution & Editorial

Back to the Problem

Subtract demands in order and report the first day the running stock dips below zero.

Complexity: O(N)