Simple Java Solution using Greedy | O(n) time and O(1) Space
Intuition\nTry to be greedy about the utilising the "moves".\n\n# Approach\n1. Maintain a cutOff variable telling you till which index do we have all \'0\'. Ini
# Intuition\nTry to be greedy about the utilising the "moves".\n\n# Approach\n1. Maintain a cutOff variable telling you till which index do we have all \'0\'. Initialise it to -1 in the beginning.\n2. Iterate through the array, and whenever encounter a \'X\'(lest say at index \'i\'), update the value of "moves" by 1(because we want all characters as \'0\'). Also, update the "cutOff" variable to (i + 2) because  all and every \'X\' till (i+2) will also convert to \'0\' so we may not waste our moves.\n3. Return "moves".\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space Complexity\nO(1)\n\n\n# Code\n```\nclass Solution {\n    public int minimumMoves(String s) {\n        \n        // cutoff: index till we have applied the operation\n        int cutOff = -1, moves = 0;\n        char[] arr = s.toCharArray();\n\n        for(int i=0 ; i<arr.length ; i++) {\n            if(arr[i]==\'X\' && i>cutOff) {\n                moves++;\n                cutOff = i + 2;\n            }\n        }\n\n        return moves;\n    }\n}\n```
['Greedy', 'Java']