You are viewing a single comment's thread. Return to all comments →
Python Here is the magic
def minimumDistances(a): d = {key:abs(a.index(key) - (len(a)-1-a[::-1].index(key))) for key in set(a) if a.count(key)>1} val = min(d.values()) if len(d)>0 else -1 return val
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Distances
You are viewing a single comment's thread. Return to all comments →
Python Here is the magic