You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just don't understand why we use "i = i + 1 - 2*count" to reset the pointer in line 31 if two nearby characters doesn't match. I replaced the line with "i = i + 1" and got the same result.
The text was updated successfully, but these errors were encountered:
I am also curious, so I added some debugging code to output
the partial string yet to check at the beginning of the iteration.
the values of i and count, at beginning and the end of each iteration
The i=i+1 proposed by Naolador seems to have the desirable/expected flow.
Allowing overlapped counting might require walking the pointer back, depending on the flow.
To illustrate, I made up a word, 'booookmaker'.
Both solutions don't allow overlapping, whereas the second 'o' forms one double with 'o' before and another double with 'o' after.
I just don't understand why we use "i = i + 1 - 2*count" to reset the pointer in line 31 if two nearby characters doesn't match. I replaced the line with "i = i + 1" and got the same result.
The text was updated successfully, but these errors were encountered: