当前位置:网站首页>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); */
边栏推荐
- Development of intelligent charging pile (I): overview of the overall design of the system
- Toolbutton property settings
- 嵌入式系统没有特别明确的定义
- Crash工具基本使用及实战分享
- Leetcode bit operation
- STM32 general timer output PWM control steering gear
- 学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
- Screen display of charging pile design -- led driver ta6932
- 2021-11-11 standard thread library
- The data read by pandas is saved to the MySQL database
猜你喜欢

Vgg16 migration learning source code

Exception handling of arm

Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction

Adaptiveavgpool1d internal implementation

An executable binary file contains more than machine instructions

pycharm 无法引入自定义包

LeetCode - 705 设计哈希集合(设计)

YOLO_ V1 summary

我想各位朋友都应该知道学习的基本规律就是:从易到难

单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇
随机推荐
The data read by pandas is saved to the MySQL database
2020-08-23
Yocto technology sharing phase IV: customize and add software package support
Dynamic layout management
Swing transformer details-2
Windows下MySQL的安装和删除
LeetCode - 508. 出现次数最多的子树元素和 (二叉树的遍历)
After clicking the Save button, you can only click it once
2021-11-11 standard thread library
自動裝箱與拆箱了解嗎?原理是什麼?
03 FastJson 解决循环引用
嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
2. Elment UI date selector formatting problem
(1) What is a lambda expression
Yocto Technology Sharing Phase 4: Custom add package support
Education is a pass and ticket. With it, you can step into a higher-level environment
Vgg16 migration learning source code
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
QT setting suspension button
Application of 51 single chip microcomputer timer