We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defalternatingCharacters(s):# Write your code hereres=0foriinrange(1,len(s)):ifs[i-1]==s[i]:res+=1returnreswhatdoyouthinkofthiscodefor'Youaregivenastringcontainingcharactersandonly.Yourtaskistochangeitintoastringsuchthattherearenomatchingadjacentcharacters.Todothis,youareallowedtodeletezeroormorecharactersinthestring.Yourtaskistofindtheminimumnumberofrequireddeletions.'??
Cookie support is required to access HackerRank
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 →