125. 유효한 팰린드롬 | LeetCode | Top Interview 150 | Coding Questions

발행: (2025년 12월 29일 오전 07:31 GMT+9)
1 min read
원문: Dev.to

Source: Dev.to

문제

솔루션

class Solution {
    public boolean isPalindrome(String s) {
        s = s.toLowerCase();
        int left = 0;
        int right = s.length() - 1;

        while (left = 'a' && chLeft = '0' && chLeft = 'a' && chRight = '0' && chRight <= '9')) {
                right--;
                continue;
            }

            // Compare the current characters
            if (chLeft != chRight) {
                return false;
            }

            left++;
            right--;
        }

        return true;
    }
}
Back to Blog

관련 글

더 보기 »