Back to problems

Design Hit Counter

Object-Oriented Programming · Apple · Medium

Design Hit Counter CodingPhoneSoftware EngineerReported Aug, 2025 Create a hit counter that reports how many hits occurred during the 5 minutes, or 300 seconds, leading up to a given time. Implement the HitCounter class: HitCounter() Creates and initializes a hit-counter object. void hit(int timestamp) Stores one hit that took place at timestamp, in seconds. More than one hit can use the same timestamp. int getHits(int timestamp) Gives the number of hits from the previous 5…

Checking your access…