Skip to content

Commit 5ae4cf1

Browse files
authored
Create Remove Palindromic Subsequences.java
1 parent 772e260 commit 5ae4cf1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public int removePalindromeSub(String s) {
3+
if (s.length() == 0) {
4+
return 0;
5+
}
6+
int start = 0;
7+
int end = s.length() - 1;
8+
while (start <= end) {
9+
if (s.charAt(start) != s.charAt(end)) {
10+
return 2;
11+
}
12+
start++;
13+
end--;
14+
}
15+
return 1;
16+
}
17+
}

0 commit comments

Comments
 (0)