Alternating Characters-
This question in similar to Super Reduced String
function superReducedString(s) {
let left = 0;
let right = 1;
let count = 0;
while (right <= s.length) {
if (s[left] === s[right]) {
count++;
}
left++;
right++;
}
return count;
}
console.log("Answere here ====>", superReducedString("AAAA"));
Top comments (0)