/** Initialize your data structure here. */
queue = new LinkedList<>();
@param timestamp - The current timestamp (in seconds granularity). */
public void hit(int timestamp) {
/** Return the number of hits in the past 5 minutes.
@param timestamp - The current timestamp (in seconds granularity). */
public int getHits(int timestamp) {
while (!queue.isEmpty() && (timeStamp - queue.peek() >= 300)) {
* Your HitCounter object will be instantiated and called as such:
* HitCounter obj = new HitCounter();
* int param_2 = obj.getHits(timestamp);