当前位置:网站首页>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;
}
}
边栏推荐
- Leetcode - 1670 conception de la file d'attente avant, moyenne et arrière (conception - deux files d'attente à double extrémité)
- 20220601数学:阶乘后的零
- When the reference is assigned to auto
- Retinaface: single stage dense face localization in the wild
- 20220609其他:多数元素
- Opencv feature extraction - hog
- QT self drawing button with bubbles
- Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
- 20220602 Mathematics: Excel table column serial number
- Opencv interview guide
猜你喜欢
Opencv+dlib to change the face of Mona Lisa
CV learning notes - Stereo Vision (point cloud model, spin image, 3D reconstruction)
CV learning notes alexnet
LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
Opencv histogram equalization
2021-10-28
Implementation of "quick start electronic" window dragging
Dictionary tree prefix tree trie
3.3 Monte Carlo Methods: case study: Blackjack of Policy Improvement of on- & off-policy Evaluation
Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)
随机推荐
『快速入门electron』之实现窗口拖拽
Development of intelligent charging pile (I): overview of the overall design of the system
CV learning notes alexnet
Problems encountered when MySQL saves CSV files
Label Semantic Aware Pre-training for Few-shot Text Classification
openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹
Pycharm cannot import custom package
2.2 DP: Value Iteration & Gambler‘s Problem
Opencv histogram equalization
Opencv notes 20 PCA
Opencv feature extraction - hog
getopt_ Typical use of long function
2021-11-11 standard thread library
4G module initialization of charge point design
2312. Selling wood blocks | things about the interviewer and crazy Zhang San (leetcode, with mind map + all solutions)
Window maximum and minimum settings
03 fastjason solves circular references
Opencv feature extraction sift
When the reference is assigned to auto
Leetcode - 1670 conception de la file d'attente avant, moyenne et arrière (conception - deux files d'attente à double extrémité)