Am I missing something?

  • 0
    class PeekingIterator : public Iterator {
    	PeekingIterator(const vector<int>& nums) : Iterator(nums) {	}
        // Returns the next element in the iteration without advancing the iterator.
    	int peek() {
            return Iterator(*this).next();

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.