Skip to content

Commit a9c2d15

Browse files
add 933
1 parent 8f5167c commit a9c2d15

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

contest/src/main/java/com/github/contest/Execute.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import java.util.TreeMap
1717
fun main() {
1818

1919
findAnagrams("abnkjhgidhr", "abn").also { println(it) }
20+
2021
}
2122

2223
infix fun Int.myRange(to: Int): IntRange {

contest/src/main/java/com/github/contest/design/DesignLeetcode.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.github.contest.design
22

3+
import java.util.LinkedList
4+
35
/**
46
* 1352. Product of the Last K Numbers
57
*/
@@ -331,4 +333,22 @@ class RLEIterator(private val encoding: IntArray) {
331333
return 0
332334
}
333335

336+
}
337+
338+
/**
339+
* 933. Number of Recent Calls
340+
*/
341+
342+
class RecentCounter() {
343+
344+
private val queue = LinkedList<Int>()
345+
346+
fun ping(t: Int): Int {
347+
queue.offer(t)
348+
349+
while (queue.peek() < t - 3000) queue.poll()
350+
351+
return queue.size
352+
}
353+
334354
}

0 commit comments

Comments
 (0)