当前位置:网站首页>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); */
边栏推荐
- Leetcode 300 最长上升子序列
- (1) What is a lambda expression
- 2021-01-03
- 干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
- After clicking the Save button, you can only click it once
- [untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
- Screen display of charging pile design -- led driver ta6932
- 要選擇那種語言為單片機編寫程序呢
- I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first
- is_ power_ of_ 2 judge whether it is a multiple of 2
猜你喜欢

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

LeetCode - 933 最近的请求次数

单片机学到什么程度能找到工作,这个标准不好量化
![[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer](/img/90/4de927e797ec9c2bb70e507392bed0.jpg)
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer

el-table X轴方向(横向)滚动条默认滑到右边

LeetCode - 703 数据流中的第 K 大元素(设计 - 优先队列)

Installation and removal of MySQL under Windows

Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction

Swing transformer details-1

openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
随机推荐
LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
51 MCU tmod and timer configuration
要選擇那種語言為單片機編寫程序呢
Basic knowledge of MySQL database (an introduction to systematization)
嵌入式系统没有特别明确的定义
Gpiof6, 7, 8 configuration
03 FastJson 解决循环引用
Modelcheckpoint auto save model
Pymssql controls SQL for Chinese queries
Opencv note 21 frequency domain filtering
[combinatorics] combinatorial existence theorem (three combinatorial existence theorems | finite poset decomposition theorem | Ramsey theorem | existence theorem of different representative systems |
Basic knowledge of communication interface
I think all friends should know that the basic law of learning is: from easy to difficult
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
Interruption system of 51 single chip microcomputer
Circular queue related design and implementation reference 1
Synchronization control between tasks
Blue Bridge Cup for migrant workers majoring in electronic information engineering
Octave instructions
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer