Skip to content

05_Valid Palindrome.md#8

Open
Kitaken0107 wants to merge 1 commit intomainfrom
Kitaken0107-patch-9
Open

05_Valid Palindrome.md#8
Kitaken0107 wants to merge 1 commit intomainfrom
Kitaken0107-patch-9

Conversation

@Kitaken0107
Copy link
Owner

s_num = []

for s_ in s:
if ord('a') <= ord(s_) <= ord('z'):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

数字は回文判定に含めるはずなのですが、考慮していますか?

if ord('a') <= ord(s_) <= ord('z'):
s_num.append(ord(s_))

half_len = len(s_num)//2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left = 0
right = len(s_num) - 1

として

whlie left < right:
    ...
    left += 1
    right -= 1

としたほうが分かりやすいと思います。ただし、個人の好みかもしれません。

```python
class Solution:
def isPalindrome(self, s: str) -> bool:
if len(s) <= 1:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この if 文は不要だと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants