Skip to content

Commit 8d212e4

Browse files
authored
Create 1750-minimum-length-of-string-after-deleting-similar-ends.py
1 parent ffd6e50 commit 8d212e4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def minimumLength(self, s: str) -> int:
3+
l, r = 0, len(s) - 1
4+
5+
while l < r and s[l] == s[r]:
6+
tmp = s[l]
7+
while l <= r and s[l] == tmp:
8+
l += 1
9+
while l <= r and s[r] == tmp:
10+
r -= 1
11+
return (r - l + 1)

0 commit comments

Comments
 (0)