You are viewing a single comment's thread. Return to all comments →
Simple loop based C++ Solution:
int alternatingCharacters(string s) { if(s.size() == 1)return 0; int deletions = 0; for(int i=1; i<s.size(); i++){ if(s[i-1] == s[i])deletions++; } return deletions; }
Seems like cookies are disabled on this browser, please enable them to open this website
Alternating Characters
You are viewing a single comment's thread. Return to all comments →
Simple loop based C++ Solution: