We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fa48ac commit a4c18c7Copy full SHA for a4c18c7
problems/1332.remove-palindromic-subsequences.md
@@ -72,7 +72,7 @@ s 仅包含字母 'a' 和 'b'
72
73
## 代码
74
75
-代码支持:Python3
+代码支持:Python3、Java
76
77
Python3 Code:
78
@@ -107,6 +107,21 @@ class Solution:
107
108
```
109
110
+Java Code:
111
+```java
112
+class Solution {
113
+ public int removePalindromeSub(String s) {
114
+ if ("".equals(s)) {
115
+ return 0;
116
+ }
117
+ if (s.equals(new StringBuilder(s).reverse().toString())) {
118
+ return 1;
119
120
+ return 2;
121
122
+}
123
+```
124
+
125
**复杂度分析**
126
- 时间复杂度:$O(N)$
127
- 空间复杂度:$O(1)$
0 commit comments