You are viewing a single comment's thread. Return to all comments →
Simple solution in Python 3:
def minimum_distance(n, A): for d in range(1, n): for i in range(n - d): if A[i] == A[i+d]: return d return -1 print(minimum_distance(int(input()), [int(x) for x in input().split()]))
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 →
Simple solution in Python 3: