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.
defalternate(s):# Write your code heremax_length=0uniques=set(s)fora,bincombinations(uniques,2):filtered=[iforiinsifi==aori==b]l=len(filtered)valid=Trueforiinrange(1,l):iffiltered[i]==filtered[i-1]:valid=Falsebreakifl>max_lengthandvalid:max_length=lreturnmax_length
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Two Characters
You are viewing a single comment's thread. Return to all comments →