You are given an integer array arrivals, where arrivals[i] represents the type of item that arrives on day i, and two integers w and m.
Items arrive sequentially from day arrivals.length i, an arriving item is discarded if retaining it would cause the frequency of item type arrivals[i] to exceed m within the sliding window of the most recent w days (from day i), considering only accepted arrivals. Otherwise, the item is accepted.
Return the total number of arrivals that must be discarded.
Constraints:
arrivals.length
arrivals[i]
w arrivals.length
m w
You are given an integer array arrivals, where arrivals[i] represents the type of item that arrives on day i, and two integers w and m.
Items arrive sequentially from day arrivals.length i, an arriving item is discarded if retaining it would cause the frequency of item type arrivals[i] to exceed m within the sliding window of the most recent w days (from day i), considering only accepted arrivals. Otherwise, the item is accepted.
Return the total number of arrivals that must be discarded.
Constraints:
arrivals.length
arrivals[i]
w arrivals.length
m w