Skip to content

Commit ed7ba04

Browse files
refactor 362
1 parent 88ba6b6 commit ed7ba04

File tree

1 file changed

+0
-37
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-37
lines changed

src/main/java/com/fishercoder/solutions/_362.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,4 @@
11
package com.fishercoder.solutions;
2-
/**
3-
* 362. Design Hit Counter
4-
*
5-
* Design a hit counter which counts the number of hits received in the past 5 minutes.
6-
7-
Each function accepts a timestamp parameter (in seconds granularity) and you may assume
8-
that calls are being made to the system in chronological order (ie, the timestamp is monotonically increasing).
9-
You may assume that the earliest timestamp starts at 1.
10-
11-
It is possible that several hits arrive roughly at the same time.
12-
13-
Example:
14-
HitCounter counter = new HitCounter();
15-
16-
// hit at timestamp 1.
17-
counter.hit(1);
18-
19-
// hit at timestamp 2.
20-
counter.hit(2);
21-
22-
// hit at timestamp 3.
23-
counter.hit(3);
24-
25-
// get hits at timestamp 4, should return 3.
26-
counter.getHits(4);
27-
28-
// hit at timestamp 300.
29-
counter.hit(300);
30-
31-
// get hits at timestamp 300, should return 4.
32-
counter.getHits(300);
33-
34-
// get hits at timestamp 301, should return 3.
35-
counter.getHits(301);
36-
Follow up:
37-
What if the number of hits per second could be very large? Does your design scale?
38-
*/
392

403
public class _362 {
414

0 commit comments

Comments
 (0)