Accept or Decline Queries

Problem Overview

  • Decide for each request to accept or decline based on per-IP count within an inclusive time window.
  • Inputs: timestamps (strings of Unix ms, sorted), matching ipAddresses, and integers limit and timeWindow; no two same-IP requests share a timestamp.
  • Output: array of 1s and 0s per request indicating acceptance or rejection.
  • Real-world context: rate limiting of network requests; common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: