Skip to content

Commit 67ab647

Browse files
Update decode_string.cpp
1 parent 09053e7 commit 67ab647

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

decode_string.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# Non recursive solution
2-
# class Solution:
3-
# def decodeString(self, s: str) -> str:
4-
# prevStr, currStr, currNum = '', '', 0
5-
# decode, ans = [], ''
6-
# for ch in s:
7-
# if ch == '[':
8-
# decode.append(currNum)
9-
# decode.append(currStr)
10-
# currStr = ''
11-
# currNum = 0
12-
# elif ch == ']':
13-
# prevStr = decode.pop()
14-
# digit = decode.pop()
15-
# currStr = prevStr + (currStr * digit)
16-
# elif ch.isdigit():
17-
# currNum = currNum * 10 + int(ch)
18-
# else:
19-
# currStr += ch
20-
# return currStr
1+
// # Non recursive solution
2+
// # class Solution:
3+
// # def decodeString(self, s: str) -> str:
4+
// # prevStr, currStr, currNum = '', '', 0
5+
// # decode, ans = [], ''
6+
// # for ch in s:
7+
// # if ch == '[':
8+
// # decode.append(currNum)
9+
// # decode.append(currStr)
10+
// # currStr = ''
11+
// # currNum = 0
12+
// # elif ch == ']':
13+
// # prevStr = decode.pop()
14+
// # digit = decode.pop()
15+
// # currStr = prevStr + (currStr * digit)
16+
// # elif ch.isdigit():
17+
// # currNum = currNum * 10 + int(ch)
18+
// # else:
19+
// # currStr += ch
20+
// # return currStr
2121

2222

2323
class Solution {

0 commit comments

Comments
 (0)