Company: Cisco_11july

Difficulty: medium

Problem Statement

An online auction site is investigating "sniping" — last-second bidding bursts intended to outpace honest bidders. The fraud team defines a suspicious window: any contiguous time window of length W seconds in which at least K bids were placed by the same user is flagged. Bids arrive in chronological order. For each bid, the fraud team wants two answers: Is the current bid part of a suspicious window? (i.e., does the user have ≥ K bids — including this one — within the last W seconds?) What is the smallest user id that is currently sniping (i.e., has ≥ K bids in the latest W-second window ending at the current bid's timestamp)? Output -1 if no user qualifies. Input N — number of bids W — window length (seconds) K — sniping threshold (bids per user) bids[i] = (t_i, u_i) — timestamp and user id; timestamps strictly increasing Input Format N W K t_1 u_1 t_2 u_2 ... t_N u_N Sample Input: 6 10 3 0 1 2 1 3 2 8 1 12 1 15 2 Output Format One line per bid: flag smallest_sniper. flag = 1 if the c

More Cisco_11july OA questionsInterview experiences