Problem library

Chat Slow Mode

Medium
queuesliding window

Slow mode allows at most limit accepted messages in any window of window seconds. A message sent at time t is accepted if fewer than limit accepted messages were sent at times greater than t - window (and at most t). Rejected messages do not count toward the limit.

times lists when each message was sent, in non-decreasing order. Return the 0-based indices of the rejected messages, in order.

Examples

Input: times = [0,1,2,3,10], limit = 2, window = 5
Output: [2,3]
Input: times = [5,5,5], limit = 3, window = 1
Output: []