Real‑time interview prompt trending
A live system‑design interview question is trending on X: design a system to detect whether a user clicked the same item twice within five minutes from a stream of clicks. (x.com) The prompt appears as practice material for stream processing and real‑time deduplication problems. (x.com)
A coding prompt about duplicate clicks is circulating on X, turning a routine stream-processing question into a public interview explainer. (x.com) The prompt asks candidates to detect whether one user clicked the same item twice within five minutes as clicks arrive in a stream, not in a finished batch. Apache Kafka describes stream processing as handling records continuously, and Apache Flink documents stateful processing as the kind of job that remembers earlier events while new ones keep arriving. (kafka.apache.org, nightlies.apache.org) In plain terms, the system keeps a short memory for each user-and-item pair, like a timer that expires after five minutes. Confluent’s Kafka Streams tutorial shows the same pattern with click events, using time windows to filter duplicates that arrive within a defined interval. (developer.confluent.io, developer.confluent.io) The hard part is time. Flink distinguishes processing time, which is the server clock, from event time, which is when the click actually happened, and it uses watermarks to estimate when late events are unlikely to keep arriving. (nightlies.apache.org, nightlies.apache.org, nightlies.apache.org) That distinction changes the answer in an interview. A design based only on wall-clock arrival can miss a late mobile click, while a design based on event timestamps needs a rule for how much lateness to tolerate before closing the five-minute window. (nightlies.apache.org, nightlies.apache.org) The usual sketch is to key the stream by user ID and item ID, store the most recent click timestamp, and evict that state after five minutes or slightly longer if late data is allowed. Flink’s timer service and Kafka Streams’ windowed state both document this kind of bounded, time-scoped memory instead of keeping every click forever. (nightlies.apache.org, developer.confluent.io, kafka.apache.org) Production systems add another wrinkle: guarantees. Kafka Streams documents at-least-once processing by default, which means retries can replay records, so engineers often pair stream logic with idempotent outputs or stronger processing guarantees when duplicates have product or billing consequences. (kafka.apache.org, kafka.apache.org) That is why a small prompt travels well online. It looks like a toy question, but it forces candidates to talk about keys, windows, late data, state cleanup, and what “same click twice” means when real systems deliver events out of order. (developer.confluent.io, nightlies.apache.org, nightlies.apache.org)