Problem intuition
The naive route is to clean the string and compare it with its reverse.
The more memory-efficient version keeps two pointers at the ends and skips every character that does not matter.
Java solution ladder
The solutions below are ordered from least optimal to most optimal, so you can see the improvement path instead of only the final answer.