java faster than 100%
Runtime: 4 ms, faster than 100.00% of Java online submissions for RLE Iterator.\nMemory Usage: 39.4 MB, less than 47.86% of Java online submissions for RLE Iter
Runtime: 4 ms, faster than 100.00% of Java online submissions for RLE Iterator.\nMemory Usage: 39.4 MB, less than 47.86% of Java online submissions for RLE Iterator.\n\n```\nclass RLEIterator {\n    int index;\n    int[] encoding;\n    public RLEIterator(int[] encoding) {\n        index = 0;\n        this.encoding = encoding;\n    }\n    \n    public int next(int n) {\n        while (index < encoding.length && n > encoding[index]) {\n            n -= encoding[index];\n            index += 2;\n            \n        }\n        if (index >= encoding.length) {\n            return -1;\n        }\n        encoding[index] -= n;\n        return encoding[index + 1]; \n    }\n}\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```
['Java']