Skip to content

Commit cea323c

Browse files
refactor 284
1 parent cdee474 commit cea323c

File tree

1 file changed

+0
-17
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-17
lines changed

src/main/java/com/fishercoder/solutions/_284.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,6 @@
44
import java.util.LinkedList;
55
import java.util.Queue;
66

7-
/**
8-
* 284. Peeking Iterator
9-
*
10-
* Given an Iterator class interface with methods: next() and hasNext(),
11-
* design and implement a PeekingIterator that support
12-
* the peek() operation -- it essentially peek() at the element that will be returned by the next call to next().
13-
14-
Here is an example. Assume that the iterator is initialized to the beginning of the queue: [1, 2, 3].
15-
16-
Call next() gets you 1, the first element in the queue.
17-
18-
Now you call peek() and it returns 2, the next element. Calling next() after that still return 2.
19-
20-
You call next() the final time and it returns 3, the last element. Calling hasNext() after that should return false.
21-
22-
Follow up: How would you extend your design to be generic and work with all types, not just integer?
23-
*/
247
public class _284 {
258
public static class Solution1 {
269
public static class PeekingIterator implements Iterator<Integer> {

0 commit comments

Comments
 (0)