You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star:) )
int alternatingCharacters(std::string _str){ size_t deletions = 0; for(auto it1 = _str.begin(), it2 = it1 + 1; it2 != _str.end(); it2++){ if(*it1 == *it2){ ++deletions; }else{ it1 = it2; } } 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 →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions/tree/master , feel free to give a star:) )