← All problemsSign in

3679. Minimum Discards to Balance Inventory

LeetCodeArrayHash TableSliding WindowSimulationCountingOpen on judge ↗

You are given two integers w and m, and an integer array arrivals, where arrivals[i] is the type of item arriving on day i (days are 1-indexed). Items are managed according to the following rules: - Each arrival may be kept or discarded; an item may only be discarded on its arrival day. - For each day i, consider the window of days [max(1, i - w + 1), i] (the w most recent days up to day i): -

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start