You are viewing a single comment's thread. Return to all comments →
def minimumDistances(a): min_d = 10000 for i in range(len(a)-1): for j in range(i+1, len(a)): if (a[i] == a[j]): min_d = min(min_d, abs(i-j)) return -1 if min_d == 10000 else min_d n = int(input()) a = list(map(int, input().split())) result = minimumDistances(a) print(result)
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 →
for Python3 Platform