ProdMatch
CompaniesCitiesRolesSign in

Companies

  • Google
  • Microsoft
  • Meta
  • Amazon
  • Apple
  • Atlassian
  • Nvidia
  • Oracle
  • See all 51 →

Cities

  • Bengaluru jobs
  • Hyderabad jobs
  • Pune jobs
  • Gurugram jobs
  • Noida jobs
  • Delhi NCR jobs
  • Mumbai jobs
  • Chennai jobs
  • Remote-India jobs

Roles

  • QA / SDET Engineers
  • Backend Engineers
  • Frontend Engineers
  • Full-stack Engineers
  • Data Analysts
  • Data Engineers
  • ML / AI Engineers
  • DevOps / SRE Engineers
  • All roles →

ProdMatch

  • About
  • Career guides
  • Compare
  • Salaries
  • Skills
  • DSA practice
  • Privacy
  • Terms
  • Sign in

© 2026 ProdMatch.ai · Built for India · DPDP Act 2023 compliant · Job data sourced from official company career pages.

Back to DSA
Sliding Windowhard70 minMobile Engineer

Gesture Streaming Window Anomaly

Mobile Engineer signal: sliding window + frequency map in a gesture recognizer context. This is a ProdMatch-owned mobile engineer drill, framed as a March 2026 Pine Labs Mobile UX simulation, not a copied platform question.

Company context

Pine Labs · Mobile UX

Freshness

March 2026

Product surface

gesture recognizer

ProdMatch interview simulation based on product-team patterns; not a claim of a real company question.

Question

For gesture recognizer, process a timestamp-ordered stream of touches. Find the longest contiguous window where at most k distinct risk labels appear and the total severity stays under budget.

Input

  • Array of events {label, severity} and integers k, budget.

Output

  • Maximum window length satisfying both constraints.

Constraints

  • 1 <= events.length <= 300000
  • 1 <= k <= 50
  • Severity values are positive integers.

Concepts

  • offline sync
  • local cache
  • gesture streams
  • sliding window
  • frequency map
  • stream processing

labels: A,B,A,C with k=2 and budget=7 -> longest valid window length is 3

Approach

Try framing your own approach first. The 30 seconds you think before peeking is where learning happens.

Clean Solution

Reveal the approach first.

How well did you understand?

Your rating tunes when this problem shows up again.

Common Mistakes

  • Update the answer only after the window is valid.
  • Avoid recomputing the whole window on every move.

Next Similar Problems

Sync Streaming Window AnomalyhardFeed Streaming Window AnomalyhardCache Streaming Window Anomalyhard