You are viewing a single comment's thread. Return to all comments →
Way to do it with out nested for loops
def minimumDistances(a): # Write your code here values = [] for i in a: start = a.index(i) if a.count(i) >= 2: #d=a.index(i, start+1) values.append(abs(a.index(i, start+1)-start)) print(i) if values: return min(values) else: return -1
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 →
Way to do it with out nested for loops