Skip to content

Commit

Permalink
Solution to today's problem
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Mar 5, 2024
1 parent 9bb112e commit 0b7f23d
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
public class Problem1750 extends LeetcodeProblem {

public int minimumLength(String _s) {
char[] arr = _s.toCharArray();
int i = 0;
int j = _s.length() - 1;
if (_s.charAt(i) == _s.charAt(j)) {
while (i < j && _s.charAt(i) == _s.charAt(j)) {
char c = _s.charAt(i);
if (arr[i] == arr[j]) {
while (i < j && arr[i] == arr[j]) {
char c = arr[i];
i++;
while (c == _s.charAt(i) && i < j) {
while (c == arr[i] && i < j) {
i++;
}
j--;
while (c == _s.charAt(j) && i < j) {
while (c == arr[j] && i < j) {
j--;
}
}
Expand Down

0 comments on commit 0b7f23d

Please sign in to comment.