当前位置:网站首页>LeetCode - 900. RLE iterator
LeetCode - 900. RLE iterator
2022-07-03 10:12:00 【Cute at the age of three @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;
}
}
边栏推荐
- Opencv+dlib to change the face of Mona Lisa
- Toolbutton property settings
- 20220610其他:任务调度器
- Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)
- 20220607其他:两整数之和
- Swing transformer details-2
- Circular queue related design and implementation reference 1
- 2.2 DP: Value Iteration & Gambler‘s Problem
- El table X-axis direction (horizontal) scroll bar slides to the right by default
- QT setting suspension button
猜你喜欢

4.1 Temporal Differential of one step

Anaconda安装包 报错packagesNotFoundError: The following packages are not available from current channels:

LeetCode - 673. 最长递增子序列的个数

CV learning notes - image filter

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

Connect Alibaba cloud servers in the form of key pairs

2312. Selling wood blocks | things about the interviewer and crazy Zhang San (leetcode, with mind map + all solutions)

Dictionary tree prefix tree trie

LeetCode - 460 LFU 缓存(设计 - 哈希表+双向链表 哈希表+平衡二叉树(TreeSet))*

2. Elment UI date selector formatting problem
随机推荐
El table X-axis direction (horizontal) scroll bar slides to the right by default
Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
2.1 Dynamic programming and case study: Jack‘s car rental
Opencv histogram equalization
(2) New methods in the interface
. DLL and Differences between lib files
Vscode markdown export PDF error
01 business structure of imitation station B project
CV learning notes alexnet
2021-10-28
Leetcode - 1670 conception de la file d'attente avant, moyenne et arrière (conception - deux files d'attente à double extrémité)
Opencv feature extraction - hog
Leetcode-513: find the lower left corner value of the tree
Dynamic layout management
LeetCode - 508. 出现次数最多的子树元素和 (二叉树的遍历)
QT self drawing button with bubbles
LeetCode - 715. Range 模块(TreeSet) *****
Discrete-event system
CV learning notes - feature extraction
Leetcode-513:找树的左下角值