Given the string s = "racecar"
, which technique can be used to efficiently check if the string is a palindrome?
Traversing the string from left to right
Using two pointers: one starting at the leftmost character and one at the rightmost, and checking for equality while moving inward.
Using recursion to compare characters at each position
None of the Above
This question is part of this quiz :
Quiz on Two Pointer Technique for DSA