Low Stock Alert
Easy · rating 950 · arrays
A warehouse tracks stock levels. The first line contains n and a threshold t. The second line contains n stock counts. Print how many products are strictly below the threshold and need restocking.
Editorial
Low Stock Alert counts how many products fall below a restock threshold. Scan the stock levels, counting values strictly less than the threshold.
print(sum(1 for x in stock if x < threshold))Complexity
Time: O(n). Space: O(1).