<jupyter_start><jupyter_text>https://www.hackerrank.com/challenges/minimum-distances/problem<jupyter_code>def minimumDistances(a):
    n = len(a)
    if n == len(set(a)):
        return -1
    def dist(arr):
        md = float('inf')
        for i in range(len(arr)-1):
            md = min(md,arr[i+1]-arr[i])
        return md
    idxs = {}
    for i,v in enumerate(a):
        if v not in idxs:
            idxs[v] = [i]
        else:
            idxs[v].append(i)
    min_dist = float('inf')
    for k,v in idxs.items():
        if len(v) > 1:
            min_dist = min(min_dist, dist(v))
    return min_dist<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14930015552099535, 'fraction_numerical': 0.006220839813374806, 'mean_word_length': 2.0961538461538463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '56566', 'license': 'MIT', 'n_tokens_mistral': 250, 'n_tokens_neox': 242, 'n_words': 49, 'path': 'hr_minimum_distances.ipynb', 'repo_name': 'devkosal/code_challenges', 'size': '643'}