25. Palindrome String
My Approach
Time and Auxiliary Space Complexity
Code (C++)
class Solution {
public:
int isPalindrome(string S) {
int i = 0, j = S.size() - 1;
while (i < j) {
if (S[i] != S[j])
return false;
++i;
--j;
}
return true;
}
};Contribution and Support
Last updated