当前位置:网站首页>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); */
边栏推荐
- 2020-08-23
- LeetCode - 460 LFU 缓存(设计 - 哈希表+双向链表 哈希表+平衡二叉树(TreeSet))*
- 当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
- I think all friends should know that the basic law of learning is: from easy to difficult
- Emballage automatique et déballage compris? Quel est le principe?
- 嵌入式系统没有特别明确的定义
- Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction
- LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)
- 对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门
- Screen display of charging pile design -- led driver ta6932
猜你喜欢

Opencv notes 20 PCA

没有多少人能够最终把自己的兴趣带到大学毕业上

LeetCode - 1670 设计前中后队列(设计 - 两个双端队列)

Not many people can finally bring their interests to college graduation

干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己

一个可执行的二进制文件包含的不仅仅是机器指令

Notes on C language learning of migrant workers majoring in electronic information engineering

Uniapp realizes global sharing of wechat applet and custom sharing button style

LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *

Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
随机推荐
(2) New methods in the interface
[keil5 debugging] warning:enumerated type mixed with other type
STM32 interrupt switch
el-table X轴方向(横向)滚动条默认滑到右边
4G module initialization of charge point design
Retinaface: single stage dense face localization in the wild
STM32 general timer 1s delay to realize LED flashing
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
LeetCode - 919. 完全二叉树插入器 (数组)
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
Notes on C language learning of migrant workers majoring in electronic information engineering
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program
There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)
4G module designed by charging pile obtains signal strength and quality
Not many people can finally bring their interests to college graduation
Basic knowledge of MySQL database (an introduction to systematization)
ADS simulation design of class AB RF power amplifier