Design Hit Counter
A medium-tier problem at 69% community acceptance, tagged with Array, Binary Search, Design. Reported in interviews at Databricks and 15 others.
Design Hit Counter shows up in live OAs at Databricks, Dropbox, Roblox, Sentry, and other infrastructure companies. It's a medium-difficulty system design question that looks straightforward on the surface but trips candidates who don't think about time windows correctly. You're building a counter that tracks hits over the last 5 minutes, and the catch is handling the query efficiently without storing every single timestamp. Most candidates either waste memory or TLE on the query path. If this problem hits your live assessment and you blank on the sliding-window trick, StealthCoder solves it in seconds invisible to the proctor.
Companies that ask "Design Hit Counter"
Design Hit Counter is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderThe trap is thinking you need to store every hit timestamp and then filter on query. That works but it's slow at scale. The real pattern is using a circular buffer or queue with a fixed 300-second window, or pairing timestamps with hit counts to compress the data. Binary search often plays a role here too, if you're keeping sorted timestamps and searching for the boundary of your time range. Many candidates default to a full array scan on every query, which fails when hit volume is high. The design questions here connect to Array and Queue topics, but the real skill is recognizing when a naive approach will fail under load. StealthCoder catches this during screen share and shows you the queue-based or bucketing approach that scales. Acceptance rate of 69% means the pattern isn't obscure, but there's still a meaningful gap between 'it works' and 'it's efficient'.
Pattern tags
You know the problem.
Make sure you actually pass it.
Design Hit Counter recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Design Hit Counter interview FAQ
Is this actually asked at FAANG during system design rounds?+
Yes, it's in rotation at Databricks, Dropbox, Roblox, Snowflake, and similar companies. It's not a whiteboard algorithm problem, it's a design problem, so they're checking if you think about constraints like memory and query speed under load.
What's the trick that makes candidates fail?+
Storing every single hit as a separate entry and scanning all of them on every query. At high volume, that's too slow. The pattern is to compress hits into time buckets or use a queue that drops old entries automatically when you query.
Why does Binary Search show up in the topics?+
If your solution uses a sorted array or list of timestamps, you binary search to find the boundary of your 300-second window instead of scanning the whole list. It's an optimization that makes query O(log n) instead of O(n).
How does this relate to data stream problems?+
Hit Counter is a classic streaming problem. You don't control when hits arrive, you need to handle them in real time, and queries need to be fast. That's exactly what data stream design tests.
Can I solve this with just an array or do I need a queue?+
Both work, but queue is cleaner. A queue naturally drops old hits when you pop from the front. An array works too if you track indices, but you have to manually manage the sliding window boundary.
Want the actual problem statement? View "Design Hit Counter" on LeetCode →