Skip to content

Latest commit

 

History

History

remove-palindromic-subsequences

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Remove palindromic subsequences

Problem link

Solutions

Solution.cpp

// https://leetcode.com/problems/remove-palindromic-subsequences

class Solution {
 public:
  int removePalindromeSub(string s) {
    if (s == "") return 0;
    for (int i = 0, n = s.size(), j = n - 1; i < j; ++i, --j)
      if (s[i] != s[j]) return 2;
    return 1;
  }
};

Tags