Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
The submit result is: Memory Limit Exceeded. It should have better solution