Find the Busiest Hour From Fulfillment Center Scan Timestamps
Last updated: November 29, 2026
Quick Overview
Given a list of scan timestamps as 'HH:MM' strings from one fulfillment center day, return the clock hour (0 to 23) with the most scans, breaking ties by the earliest hour. Then generalize to the busiest 60-minute window starting at any minute.
Amazon
November 29, 20260
0
0 solved
Given a list of scan timestamps as 'HH:MM' strings from one fulfillment center day, return the clock hour (0 to 23) with the most scans, breaking ties by the earliest hour. Then generalize to the busiest 60-minute window starting at any minute.
A practical counting question in the style Amazon uses for operations-flavored phone screens. The first part checks parsing and bucketing; the follow-up checks whether you can move from fixed buckets to a sliding window efficiently.
What the Interviewer Expects
- Parse timestamps safely and bucket by hour
- Apply the tie-break rule explicitly
- For the sliding version, use minute counts plus a window sum or prefix sums
- Avoid O(n * 60) rescanning when a prefix sum works
- Discuss malformed input
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 this change if timestamps span multiple days and time zones?
- What if you need the busiest window of arbitrary length L?
- How would you compute this continuously as scans stream in?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Timestamps are valid 24-hour 'HH:MM'. Part 1 returns an hour 0 to 23; ties go to the earliest hour. If the list is empty return None. Part 2 returns the start minute (0 to 1439) of the 60-minute windo...
High-Level Design
Part 1: a 24-slot array, increment counts[int(ts[:2])], then pick the max with the smallest index (iterating in order and using strict > gives the earliest tie winner).
Part 2: build a 1440-slot ...