Tap here to switch tabs
Problem
Submissions

Problem: Logger Rate Limiter

Logger Rate Limiter receives messages with ascending timestamps and decides whether each request is displayed, rejecting the same message if it was displayed within the previous S seconds.

Statement

For the given stream of message requests and their timestamps as input, you must implement a logger rate limiter system that decides whether the current message request is displayed. The decision depends on whether the same message has already been displayed in the last SS seconds. If yes, then the decision is FALSE, as this message is considered a duplicate. Otherwise, the decision is TRUE.

Note: Several message requests, though received at different timestamps, may carry identical messages.

Constraint:

  • 1≤1 \leq request.length ≤102\leq 10^{2}
  • 0≤0 \leq timestamp ≤103\leq 10^{3}
  • Timestamps are in ascending order.
  • Messages can be written in lowercase or uppercase English alphabets.
⋮
Tap here to switch tabs
Problem
Submissions

Problem: Logger Rate Limiter

Logger Rate Limiter receives messages with ascending timestamps and decides whether each request is displayed, rejecting the same message if it was displayed within the previous S seconds.

Statement

For the given stream of message requests and their timestamps as input, you must implement a logger rate limiter system that decides whether the current message request is displayed. The decision depends on whether the same message has already been displayed in the last SS seconds. If yes, then the decision is FALSE, as this message is considered a duplicate. Otherwise, the decision is TRUE.

Note: Several message requests, though received at different timestamps, may carry identical messages.

Constraint:

  • 1≤1 \leq request.length ≤102\leq 10^{2}
  • 0≤0 \leq timestamp ≤103\leq 10^{3}
  • Timestamps are in ascending order.
  • Messages can be written in lowercase or uppercase English alphabets.