Fixed-Size Sliding Window with Average and Mode

Design a fixed-capacity data window of size k that supports:

  • add(x): add integer x to the window. If the window is full (already holds k numbers), first evict the oldest number, then insert...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: