File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
contest/src/main/java/com/github/contest Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import java.util.TreeMap
1717fun main () {
1818
1919 findAnagrams(" abnkjhgidhr" , " abn" ).also { println (it) }
20+
2021}
2122
2223infix fun Int.myRange (to : Int ): IntRange {
Original file line number Diff line number Diff line change 11package 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}
You can’t perform that action at this time.
0 commit comments