bool isPalindrome(string& s) string rev = s reverse(rev.begin(), rev.end()) return s == rev Is the algorithm correct? What is the space and time complexity?
can u explain this?
bool isPalindrome(string& s) string rev = s reverse(rev.begin(), rev.end()) return s == rev Is the algorithm correct? What is the space and time complexity?
can u explain this?