当前位置:网站首页>LeetCode - 933 最近的请求次数
LeetCode - 933 最近的请求次数
2022-07-03 09:20:00 【三岁就很萌@D】
双端队列
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); */
边栏推荐
- Which language should I choose to program for single chip microcomputer
- Sending and interrupt receiving of STM32 serial port
- Google browser plug-in recommendation
- 2. Elment UI date selector formatting problem
- JS基础-原型原型链和宏任务/微任务/事件机制
- About windows and layout
- Do you understand automatic packing and unpacking? What is the principle?
- My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
- Problems encountered when MySQL saves CSV files
- Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
猜你喜欢
手机都算是单片机的一种,只不过它用的硬件不是51的芯片
Leetcode 300 最长上升子序列
There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
Exception handling of arm
yocto 技术分享第四期:自定义增加软件包支持
MySQL root user needs sudo login
03 FastJson 解决循环引用
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
Crash工具基本使用及实战分享
编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
随机推荐
Serial communication based on 51 single chip microcomputer
Leetcode 300 最长上升子序列
Sending and interrupt receiving of STM32 serial port
我想各位朋友都应该知道学习的基本规律就是:从易到难
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
el-table X轴方向(横向)滚动条默认滑到右边
Gif image analysis drawing RGB to YUV table lookup method to reduce CPU occupancy
Swing transformer details-1
Project scope management__ Scope management plan and scope specification
Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~
The data read by pandas is saved to the MySQL database
2020-08-23
Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction
手机都算是单片机的一种,只不过它用的硬件不是51的芯片
Emballage automatique et déballage compris? Quel est le principe?
How does the memory database give full play to the advantages of memory?
Problems encountered when MySQL saves CSV files
2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
QT qcombobox QSS style settings