File tree 3 files changed +55
-0
lines changed
solution/1300-1399/1332.Remove Palindromic Subsequences
3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,26 @@ func reverse(s string) string {
136
136
}
137
137
```
138
138
139
+ ### ** Rust**
140
+
141
+ ``` rust
142
+ impl Solution {
143
+ pub fn remove_palindrome_sub (s : String ) -> i32 {
144
+ let mut l = 0 ;
145
+ let mut r = s . len () - 1 ;
146
+ let s : Vec <char > = s . chars (). collect ();
147
+ while l < r {
148
+ if s [l ] != s [r ] {
149
+ return 2 ;
150
+ }
151
+ l += 1 ;
152
+ r -= 1 ;
153
+ }
154
+ 1
155
+ }
156
+ }
157
+ ```
158
+
139
159
### ** ...**
140
160
141
161
```
Original file line number Diff line number Diff line change @@ -126,6 +126,26 @@ func reverse(s string) string {
126
126
}
127
127
```
128
128
129
+ ### ** Rust**
130
+
131
+ ``` rust
132
+ impl Solution {
133
+ pub fn remove_palindrome_sub (s : String ) -> i32 {
134
+ let mut l = 0 ;
135
+ let mut r = s . len () - 1 ;
136
+ let s : Vec <char > = s . chars (). collect ();
137
+ while l < r {
138
+ if s [l ] != s [r ] {
139
+ return 2 ;
140
+ }
141
+ l += 1 ;
142
+ r -= 1 ;
143
+ }
144
+ 1
145
+ }
146
+ }
147
+ ```
148
+
129
149
### ** ...**
130
150
131
151
```
Original file line number Diff line number Diff line change
1
+ impl Solution {
2
+ pub fn remove_palindrome_sub ( s : String ) -> i32 {
3
+ let mut l = 0 ;
4
+ let mut r = s. len ( ) - 1 ;
5
+ let s: Vec < char > = s. chars ( ) . collect ( ) ;
6
+ while l < r {
7
+ if s[ l] != s[ r] {
8
+ return 2 ;
9
+ }
10
+ l += 1 ;
11
+ r -= 1 ;
12
+ }
13
+ 1
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments