Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Digits Doublets by TovarischZhukov
def cm(v1,v2):
v1=str(v1);v2=str(v2);c=0
for i,val in enumerate(v1):
if val==v2[i]:c+=1
return c==2
def find (n,st,end,ind=1):
r=[]
for i,val in enumerate(n):
if cm(val,end) and cm(val,st): return [val]
if cm(val,st):
c=find(n[:i]+n[i+1:],val,end)
if c: r.append([val]+c)
return min(r,key=len) if r else r
def checkio(n):
st=n[0]
end=n[-1]
return [st]+find(n[1:-1],st,end,0)+[end]
Jan. 5, 2016