C++ || Simple || Short || Easy to understand
\n\n# Code\n\nclass RLEIterator {\npublic:\n    vector<int> arr;\n    int l = 0;\n    int size;\n    RLEIterator(vector<int>& encoding) {\n        arr = encodin
\n\n# Code\n```\nclass RLEIterator {\npublic:\n    vector<int> arr;\n    int l = 0;\n    int size;\n    RLEIterator(vector<int>& encoding) {\n        arr = encoding;\n        size = arr.size();\n    }\n    \n    int next(int n) {  \n        while(l < size && arr[l] < n){\n            n -= arr[l];\n            l += 2;\n        }\n        if(l < size && arr[l] >= n){\n            arr[l] -= n;\n            return arr[l+1];\n        }\n        return -1;\n    }\n};\n\n// just dry run the code \n\n/**\n * Your RLEIterator object will be instantiated and called as such:\n * RLEIterator* obj = new RLEIterator(encoding);\n * int param_1 = obj->next(n);\n */\n```
['C++']