[Python3] loop through array
\n\nclass RLEIterator:\n\n    def __init__(self, A: List[int]):\n        self.rle = A\n        self.k = 0 \n\n    def next(self, n: int) -> int:\n        while 
\n```\nclass RLEIterator:\n\n    def __init__(self, A: List[int]):\n        self.rle = A\n        self.k = 0 \n\n    def next(self, n: int) -> int:\n        while self.k < len(self.rle) and n > self.rle[self.k]: \n            n -= self.rle[self.k]\n            self.k += 2 \n        if self.k < len(self.rle): \n            self.rle[self.k] -= n\n            return self.rle[self.k+1]\n        return -1 \n```
['Python3']