You are viewing a single comment's thread. Return to all comments →
Little bit confusion but I got it with a simple logic.
100% pass all testcases.
def alternate(s): x=set(s) m=0 l=list(map(set,combinations(x,2))) for i in l: y=x-i z=s for j in y: z=z.replace(j,"") r=("".join(i))*(len(z)//2) if r+r[0]==z or r==z or r==z[::-1] or r[1]+r==z: m=max(m,len(z)) return m
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 →
Little bit confusion but I got it with a simple logic.
100% pass all testcases.