File tree 1 file changed +0
-13
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-13
lines changed Original file line number Diff line number Diff line change @@ -13,20 +13,12 @@ public static class HitCounter {
13
13
private int [] hits ;
14
14
private int k ;
15
15
16
- /**
17
- * Initialize your data structure here.
18
- */
19
16
public HitCounter () {
20
17
k = 300 ;
21
18
times = new int [k ];
22
19
hits = new int [k ];
23
20
}
24
21
25
- /**
26
- * Record a hit.
27
- *
28
- * @param timestamp - The current timestamp (in seconds granularity).
29
- */
30
22
public void hit (int timestamp ) {
31
23
int index = timestamp % k ;
32
24
if (times [index ] != timestamp ) {
@@ -37,11 +29,6 @@ public void hit(int timestamp) {
37
29
}
38
30
}
39
31
40
- /**
41
- * Return the number of hits in the past 5 minutes.
42
- *
43
- * @param timestamp - The current timestamp (in seconds granularity).
44
- */
45
32
public int getHits (int timestamp ) {
46
33
int total = 0 ;
47
34
for (int i = 0 ; i < k ; i ++) {
You can’t perform that action at this time.
0 commit comments