Valid Palindrome

Step 2: Valid Palindrome

Implement is_palindrome(s). A string is a palindrome if it reads the same forward and backward after ignoring case and skipping every character that is not alphanumeric.

Use a left pointer and a right pointer. Advance each past any non-alphanumeric characters, then compare the two characters case-insensitively. If they differ, return False. Continue until the pointers meet. An empty string counts as a palindrome.

Hints
Starter code
def two_sum_sorted(nums, target):
    i, j = 0, len(nums) - 1
    while i < j:
        s = nums[i] + nums[j]
        if s == target:
            return (i, j)
        elif s < target:
            i += 1
        else:
            j -= 1
    return None


def is_palindrome(s):
    """Return True if s is a palindrome ignoring case and non-alphanumerics."""
    # TODO: use left and right pointers, skipping non-alphanumeric characters
    pass
Write it on a laptop

The editor and the test runner need a wide screen. Open this page on a desktop browser and your progress will be waiting.