We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent da6b079 commit 424e885Copy full SHA for 424e885
src/main/java/com/fishercoder/solutions/_394.java
@@ -18,19 +18,16 @@ public String decodeString(String s) {
18
while (s.charAt(idx + 1) >= '0' && s.charAt(idx + 1) <= '9') {
19
idx++;
20
}
21
-
22
count.push(Integer.parseInt(s.substring(start, idx + 1)));
23
} else if (s.charAt(idx) == '[') {
24
str.push("");
25
} else if (s.charAt(idx) == ']') {
26
String st = str.pop();
27
StringBuilder sb = new StringBuilder();
28
int n = count.pop();
29
30
for (int j = 0; j < n; j++) {
31
sb.append(st);
32
33
34
str.push(str.pop() + sb.toString());
35
} else {
36
str.push(str.pop() + s.charAt(idx));
0 commit comments