LeetCode Records - Question 2027 Minimum Moves to Convert String
class Solution {
public int minimumMoves(String s) {
int count = 0;
char[] arr = s.toCharArray();
for (int i = 0; i < arr.length; ) {
if (arr[i] == 'X') {
count++;
i += 3;
} else {
i++;
}
}
return count;
}
}- Runtime: 0 ms (Beats: 100.00%)
- Memory: 41.48 MB (Beats: 34.88%)