You are viewing a single comment's thread. Return to all comments →
def minimumDistances(a): dist = float('inf') for i in range(len(a)): if a[i] in a[i+1:]: b = a.index(a[i],i+1,len(a)) dist = min(dist,abs(i-b)) if dist == float('inf'): return -1 else: return dist
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 →