当前位置:网站首页>Leetcode - 933 number of recent requests
Leetcode - 933 number of recent requests
2022-07-03 10:05:00 【Cute at the age of three @d】


deque

class RecentCounter {
private Deque<Integer> deque;
public RecentCounter() {
deque = new LinkedList<>();
}
public int ping(int t) {
deque.offerLast(t);
while(deque.size()!= 0 && t - 3000 > deque.peekFirst())
deque.pollFirst();
return deque.size();
}
}
/** * Your RecentCounter object will be instantiated and called as such: * RecentCounter obj = new RecentCounter(); * int param_1 = obj.ping(t); */
边栏推荐
- 2021-11-11 standard thread library
- Yocto Technology Sharing Phase 4: Custom add package support
- Stm32f407 key interrupt
- The underlying principle of vector
- Simulate mouse click
- Screen display of charging pile design -- led driver ta6932
- 2. Elment UI date selector formatting problem
- QT detection card reader analog keyboard input
- Swing transformer details-1
- Opencv notes 20 PCA
猜你喜欢

03 FastJson 解决循环引用

Exception handling of arm

Opencv note 21 frequency domain filtering

Octave instructions

Dictionary tree prefix tree trie

Swing transformer details-1

LeetCode - 919. 完全二叉树插入器 (数组)

It is difficult to quantify the extent to which a single-chip computer can find a job

JS foundation - prototype prototype chain and macro task / micro task / event mechanism

2021-10-28
随机推荐
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
Windows下MySQL的安装和删除
单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了
Oracle database SQL statement execution plan, statement tracking and optimization instance
Modelcheckpoint auto save model
My notes on intelligent charging pile development (II): overview of system hardware circuit design
Yocto Technology Sharing Phase 4: Custom add package support
Opencv notes 20 PCA
(2)接口中新增的方法
Stm32f407 key interrupt
03 FastJson 解决循环引用
[keil5 debugging] warning:enumerated type mixed with other type
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
Serial port programming
Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)
Adaptiveavgpool1d internal implementation
我想各位朋友都应该知道学习的基本规律就是:从易到难
LeetCode - 1670 设计前中后队列(设计 - 两个双端队列)
Leetcode 300 最长上升子序列
[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation