EASY JAVA SOLUTION O(n) time complexity!!!!
Approachtake two variables 'i' for iterating through the string elements
and 'step' for keeping track of the no of steps. run a while loop through all the eleme

# Approach
take two variables **'i'** for iterating through the string elements
and **'step'** for keeping track of the no of steps. run a while loop through all the elements of the string. if found an 'X' increment the pointer i an include three consecutive elemnts thereby considering it as a step. Increment **'step'** by 1. or else incremnt **'i'** by 1. break the loop and return the value storedin the variable **'step'** AND VOILAA!!

# Complexity
- Time complexity: **O(n)**


- Space complexity: **O(1)**


# Code
```java []
class Solution {
    public int minimumMoves(String s) {
        int i=0, step=0;
        while(i<s.length()){
            if(s.charAt(i)=='X'){
                i+=3;
                step++;
            }else
                i++;
            }
        
        return step;
        }
    }
    

```
['Java']