当前位置:网站首页>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;
}
}
边栏推荐
- STM32 general timer output PWM control steering gear
- yocto 技術分享第四期:自定義增加軟件包支持
- Dynamic layout management
- My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
- Quelle langue choisir pour programmer un micro - ordinateur à puce unique
- byte alignment
- 使用sed替换文件夹下文件
- The data read by pandas is saved to the MySQL database
- SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers
- Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
猜你喜欢

LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)

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

pycharm 无法引入自定义包
![[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation](/img/06/7fd985faf8806ceface3864d4b3180.png)
[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation

It is difficult to quantify the extent to which a single-chip computer can find a job

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

The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving

SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers

QT is a method of batch modifying the style of a certain type of control after naming the control

03 FastJson 解决循环引用
随机推荐
编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
Vgg16 migration learning source code
The data read by pandas is saved to the MySQL database
没有多少人能够最终把自己的兴趣带到大学毕业上
Opencv note 21 frequency domain filtering
Stm32f407 key interrupt
RESNET code details
Opencv notes 17 template matching
Do you understand automatic packing and unpacking? What is the principle?
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
Which language should I choose to program for single chip microcomputer
Basic knowledge of communication interface
单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了
2020-08-23
MySQL root user needs sudo login
When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
I think all friends should know that the basic law of learning is: from easy to difficult
My notes on intelligent charging pile development (II): overview of system hardware circuit design
After clicking the Save button, you can only click it once
LeetCode 面试题 17.20. 连续中值(大顶堆+小顶堆)