class Solution:
def minimumLength(self, s: str) -> int:
if len(s) == 1:
return 1
if s == s[0] * len(s):
return 0
i, j = 0, len(s)-1
while i < j and s[i] == s[j]:
x = s[i]
while x == s[i]: i += 1
while x == s[j]: j -= 1
return max(j - i + 1, 0)
왜 Easy가 아닐까?
댓글 0