Deduplicate Trackside AEI Tag Reads Within a Time Window
Last updated: November 29, 2026
Quick Overview
Trackside AEI readers emit repeated RFID reads of the same rail car as it rolls past or sits nearby. Given a list of (timestamp, reader_id, car_id) reads, keep a read only if no kept read of the same car at the same reader happened in the previous 60 seconds.
Bnsf
November 29, 20260
0
0 solved
Trackside AEI readers emit repeated RFID reads of the same rail car as it rolls past or sits nearby. Given a list of (timestamp, reader_id, car_id) reads, keep a read only if no kept read of the same car at the same reader happened in the previous 60 seconds.
A warm-up in the style of a BNSF phone screen, framed around the car location events that feed shipment tracing. The interviewer checks that you clarify the dedupe rule (relative to the last kept read, not the last seen read), handle unsorted input, and pick a hash map keyed on the right pair.
What the Interviewer Expects
- Asks whether the window is measured from the last kept read or the last raw read
- Sorts by timestamp before processing
- Uses a dictionary keyed on (reader_id, car_id)
- Gets O(n log n) time with O(k) extra space
- Names how this would run as a streaming operator
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you do this on an unbounded stream where reads arrive slightly out of order?
- How do you bound memory when millions of distinct cars pass through a day?
- What changes if the same car can legitimately pass the same reader twice in one minute, such as during a yard switching move?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a list of reads (ts_seconds, reader_id, car_id), possibly unsorted. Output: the reads to keep, in time order. A read is kept when there is no earlier kept read of the same car at the same...
High-Level Design
Sort by timestamp, then sweep once with a dictionary last_kept[(reader, car)] = ts. Reads at different readers are independent, so the key must be the pair, not the car alone....