You are viewing a single comment's thread. Return to all comments →
Here is my Python solution!
def minimumDistances(a): distances = [] if len(a) == len(set(a)): return -1 for num in range(len(a)): if a[num] in a[num + 1:]: distances.append(abs(num - (a[num + 1:].index(a[num]) + num + 1))) return min(distances)
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 →
Here is my Python solution!