Skip to content

125. Valid Palindrome#2

Open
yamashita-ki wants to merge 2 commits intomainfrom
leetcode/125
Open

125. Valid Palindrome#2
yamashita-ki wants to merge 2 commits intomainfrom
leetcode/125

Conversation

@yamashita-ki
Copy link
Owner

@yamashita-ki yamashita-ki changed the title Valid Palindrome 125. Valid Palindrome Sep 12, 2025
while(l < r && !this.isAlphanumeric(s.charAt(l))){
l++;
}
if(Character.toLowerCase(s.charAt(r)) != Character.toLowerCase(s.charAt(l))){
Copy link

Choose a reason for hiding this comment

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

これ、入力に "***" などが来るとどうなりますかね。この行が実行されて、下に抜けるので一応問題はないはずですが、ちょっと予想した動きではないような感覚を持ちました。

この上で l, r を比較して break するか、while を if に変えて continue するか。
いくつか選択はありそうですが、あまりしっくり来ませんね。

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