84% Faster || Easy Solution || C++ || O(n) Time
\nclass RLEIterator {\npublic:\n    \n    vector<int> e;\n    int id = 0;\n    RLEIterator(vector<int>& encoding) {\n        e = encoding;\n    }\n    \n    int
```\nclass RLEIterator {\npublic:\n    \n    vector<int> e;\n    int id = 0;\n    RLEIterator(vector<int>& encoding) {\n        e = encoding;\n    }\n    \n    int next(int n) {\n        while ( id < e.size() && n > 0  ) {\n            if ( n <= e[id] ) {\n                e[id] -= n;\n                return e[id+1];\n            }\n            else {\n                n -= e[id];\n                id += 2;\n            }\n        }\n        \n        return -1;\n    }\n};\n```
['C']