JAVA solution, using only a List. 4ms beats 100% of current Java submissions.
/ This stores the the pair of frequency, value. Which we will use to derive the encoded sequence. */\n    List encodedPairs = new ArrayList<>();\n\n    / This s
/** This stores the the pair of frequency, value. Which we will use to derive the encoded sequence. */\n    List<int[]> encodedPairs = new ArrayList<>();\n\n    /** This stores the pointer to the next encoded string value that we are on. */\n    int currentIndex = 0;\n\n    /** The constructor will store the pairs into the list. */\n    public RLEIterator(int[] A) {\n        int i=0;\n        while (i < A.length) {\n            int freq = A[i];\n            int val = A[i+1];\n            encodedPairs.add(new int[]{freq,val});\n            i+=2;\n        }\n    }\n\n    public int next(int n) {\n        while (n > 0) {\n            if (currentIndex < encodedPairs.size()) {\n                int[] pair = encodedPairs.get(currentIndex);\n                /** Subtract from n the frequencies in the current pair until we land on the pair where the frequency count is > what is left of n  */\n                if (n - pair[0] > 0) {\n                    n -= pair[0];\n                    currentIndex++;\n                    continue;\n                } else {\n                    /** We need to update the list value here for the next call to this method. */\n                    encodedPairs.set(currentIndex, new int[]{pair[0]-n,pair[1]});\n                }\n                return pair[1];\n            } else {\n                return -1;\n            }\n        }\n        return -1;\n    }\n
[]