原题链接:https://leetcode-cn.com/problems/remove-palindromic-subsequences/
class Solution {
public:
int removePalindromeSub(string s) {
return isPalindrome(s) ? 1 : 2;
}
bool isPalindrome(string s) {
int n = s.size();
for (int i = 0, j = n - 1; i < j; i++, j--) {
if (s[i] != s[j]) return false;
}
return true;
}
};