Practice Questions
Practice Questions
● Approach: Two pointers - one at the beginning and one at the end.
● Logic:
1. Use two pointers, left and right, initialized to the beginning and end of the string,
respectively.
2. While left is less than right:
■ If the characters at left and right are not equal, the string is not a palindrome.
■ Otherwise, increment left and decrement right.
3. If the loop completes without finding any unequal characters, the string is a palindrome.