Is Palindrome String — Java Coding Problem
Difficulty: easy | Category: two-pointers
Problem Description
Given a string `s`, return `true` if it is a palindrome (reads the same forwards and backwards), or `false` otherwise. A palindrome ignores case — `"Racecar"` is a palindrome. Only consider alphanumeric characters and ignore all others. Hint: Use two pointers starting at each end and compare characters, skipping non-alphanumeric ones.
Examples
Example 1
Input: s = "racecar"
Output: true
Explanation: "racecar" reads the same forwards and backwards.
Example 2
Input: s = "hello"
Output: false
Example 3
Input: s = "A man a plan a canal Panama"
Output: true
Explanation: Ignoring spaces and case.