当前位置:网站首页>LeetCode - 900. RLE 迭代器
LeetCode - 900. RLE 迭代器
2022-07-03 09:20:00 【三岁就很萌@D】



class RLEIterator {
private int[] encoding;
private int tail;
public RLEIterator(int[] encoding) {
this.encoding = encoding;
this.tail = 0;
}
public int next(int n) {
int num = n;
int len = encoding.length;
while(tail < len && num > encoding[tail]){
num -= encoding[tail];
tail += 2;
}
if(tail < len){
encoding[tail] -= num;
return encoding[tail+1];
}
else
return -1;
}
}
边栏推荐
- Crash工具基本使用及实战分享
- Pymssql controls SQL for Chinese queries
- The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
- QT self drawing button with bubbles
- Quelle langue choisir pour programmer un micro - ordinateur à puce unique
- Not many people can finally bring their interests to college graduation
- 2020-08-23
- RESNET code details
- [Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
- LeetCode - 673. 最长递增子序列的个数
猜你喜欢

RESNET code details

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

Exception handling of arm

学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里

新系列单片机还延续了STM32产品家族的低电压和节能两大优势

Blue Bridge Cup for migrant workers majoring in electronic information engineering

当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学

SCM is now overwhelming, a wide variety, so that developers are overwhelmed

手机都算是单片机的一种,只不过它用的硬件不是51的芯片

LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
随机推荐
一个可执行的二进制文件包含的不仅仅是机器指令
4G module board level control interface designed by charging pile
使用密钥对的形式连接阿里云服务器
Positive and negative sample division and architecture understanding in image classification and target detection
Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门
QT detection card reader analog keyboard input
(2) New methods in the interface
03 fastjason solves circular references
Vscode markdown export PDF error
Swing transformer details-2
After clicking the Save button, you can only click it once
Development of intelligent charging pile (I): overview of the overall design of the system
getopt_ Typical use of long function
4G module at command communication package interface designed by charging pile
The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
Simple use of MySQL (addition, deletion, modification and query)
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction