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.
defhappyLadybugs(b):# Write your code hereifb.count('_')==0:i=1whilei<=len(b)-2and(b[i]==b[i-1]orb[i]==b[i+1]):i+=1ifi==len(b)-1andb[i]==b[i-1]:return'YES'else:return'NO't=Counter(b)check=Trueforiint.keys():ifi!='_'andt[i]==1:check=Falsebreakreturn'YES'ifcheckelse'NO'
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Happy Ladybugs
You are viewing a single comment's thread. Return to all comments →
python3: