File tree 1 file changed +0
-31
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-31
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .ArrayDeque ;
4
4
import java .util .Deque ;
5
5
6
- /**
7
- * 604. Design Compressed String Iterator
8
- *
9
- * Design and implement a data structure for a compressed string iterator. It should support the following operations: next and hasNext.
10
- The given compressed string will be in the form of each letter followed by a positive integer representing
11
- the number of this letter existing in the original uncompressed string.
12
-
13
- next() - if the original string still has uncompressed characters, return the next letter; Otherwise return a white space.
14
- hasNext() - Judge whether there is any letter needs to be uncompressed.
15
-
16
- Note:
17
- Please remember to RESET your class variables declared in StringIterator,
18
- as static/class variables are persisted across multiple test cases. Please see here for more details.
19
-
20
- Example:
21
-
22
- StringIterator iterator = new StringIterator("L1e2t1C1o1d1e1");
23
-
24
- iterator.next(); // return 'L'
25
- iterator.next(); // return 'e'
26
- iterator.next(); // return 'e'
27
- iterator.next(); // return 't'
28
- iterator.next(); // return 'C'
29
- iterator.next(); // return 'o'
30
- iterator.next(); // return 'd'
31
- iterator.hasNext(); // return true
32
- iterator.next(); // return 'e'
33
- iterator.hasNext(); // return false
34
- iterator.next(); // return ' '
35
-
36
- */
37
6
public class _604 {
38
7
public static class Solution1 {
39
8
public static class StringIterator {
You can’t perform that action at this time.
0 commit comments