Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 284. Peeking Iterator
Wrap an existing iterator to add a peek() operation that returns the next element without advancing the iterator, while preserving correct behavior for next() and hasNext() across multiple calls. The challenge is to maintain the iterator state so peek() can be called repeatedly without consuming the element (and to generalize this design for any type).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.