https://leetcode.com/problems/number-of-recent-calls/ Easy

Решение

class RecentCounter() {
    private val times = IntArray(10010)
    private var head = 0
    private var tail = 0

    fun ping(t: Int): Int {
        times[tail++] = t
        val min = t - 3000
        while (head < tail && times[head] < min) head++
        return tail - head
    }
}