Skip to content

Commit b98419a

Browse files
add 1332
1 parent 6de4ca9 commit b98419a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ _If you like this project, please leave me a star._ ★
224224
|1338|[Reduce Array Size to The Half](https://leetcode.com/problems/reduce-array-size-to-the-half/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1338.java) | |Medium||
225225
|1337|[Remove Palindromic Subsequences](https://leetcode.com/problems/remove-palindromic-subsequences/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1337.java) | |Easy|String|
226226
|1333|[Filter Restaurants by Vegan-Friendly, Price and Distance](https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1333.java) | |Medium||
227+
|1332|[Remove Palindromic Subsequences](https://leetcode.com/problems/remove-palindromic-subsequences/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1332.java) | |Easy|String|
227228
|1331|[Rank Transform of an Array](https://leetcode.com/problems/rank-transform-of-an-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1331.java) | |Easy||
228229
|1329|[Sort the Matrix Diagonally](https://leetcode.com/problems/sort-the-matrix-diagonally/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1329.java) | |Medium||
229230
|1325|[Delete Leaves With a Given Value](https://leetcode.com/problems/delete-leaves-with-a-given-value/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1325.java) | |Medium|Tree|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1332 {
4+
public static class Solution1 {
5+
/**
6+
* Notice: there are only two characters in the given string: 'a' and 'b'
7+
*/
8+
public int removePalindromeSub(String s) {
9+
if (s.isEmpty()) {
10+
return 0;
11+
}
12+
if (s.equals((new StringBuilder(s)).reverse().toString())) {
13+
return 1;
14+
}
15+
return 2;
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)