class Solution:
def makePalindrome(self, s: str) -> bool:
count=0
st=0
en=len(s)-1
for i in range(len(s)//2):
if s[st]!=s[en]:
count+=1
if count>2:
return False
st+=1
en-=1
return True
'알고리즘 문제 > Leetcode' 카테고리의 다른 글
1876. Substrings of Size Three with Distinct Characters (0) | 2023.05.02 |
---|---|
921. Minimum Add to Make Parentheses Valid (0) | 2023.05.02 |
1198. Find Smallest Common Element in All Rows (0) | 2023.05.02 |
2221. Find Triangular Sum of an Array (0) | 2023.05.02 |
2149. Rearrange Array Elements by Sign (0) | 2023.05.02 |