Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42c7881

Browse files
authored
Match video solution exactly
1 parent f2292ed commit 42c7881

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/1209-Remove-All-Adjacent-Duplicates-in-String-II.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Solution:
22
def removeDuplicates(self, s: str, k: int) -> str:
3-
stack = [] #[char, count]
3+
stack = [] # [char, count]
44

55
for c in s:
66
if stack and stack[-1][0] == c:
@@ -13,6 +13,6 @@ def removeDuplicates(self, s: str, k: int) -> str:
1313

1414
res = ""
1515
for char, count in stack:
16-
res += char * count
16+
res += (char * count)
1717

1818
return res

0 commit comments

Comments
 (0)