Design a hit counter that counts the number of hits received in the past 5 minutes (300 seconds).
hit(timestamp)records a hit at the given timestamp (in seconds).getHits(timestamp)returns the number of hits in the past 300 seconds. A hit at timetcounts toward a query attimestampift > timestamp - 300(the trailing 300-second window, exclusive of the boundary).
Hits and queries are issued in non-decreasing timestamp order.
Implement the function hitCounter(operations) where operations is a list of [op, ...args]: ["hit", timestamp] and ["getHits", timestamp]. For "hit" return null; for "getHits" return the count. Return the list of results, one per operation (use null for operations that return nothing).