We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae3f9bd commit 7208b7aCopy full SHA for 7208b7a
scripts/algorithms/M/Minimum Moves to Convert String/Minimum Moves to Convert String.js
@@ -1,17 +1,18 @@
1
+// Runtime: 73 ms (Top 80.85%) | Memory: 42.2 MB (Top 59.57%)
2
var minimumMoves = function(s) {
3
let move = 0;
4
let i = 0;
5
while(i<s.length){
6
let char = s[i];
- // incrementing the index if we already have 'O'
7
+ // incrementing the index if we already have 'O'
8
if(char== 'O'){
9
i++;
10
}
- // incrementing the move and index by 3 (Per move = 3 characters)
11
+ // incrementing the move and index by 3 (Per move = 3 characters)
12
if(char== 'X'){
13
i=i+3;
14
move++;
15
16
17
return move;
-};
18
+};
0 commit comments