Revert "make IsPalendrome O(n)"

This reverts commit 199e66cc0a630a12c19be6faa25370db7d6e3471.
IsPalendrome O(n) with clean commit