Minimum Distances between Similar numbers in an array
The distance between two array values is the number of indices between them. Given , find the minimum distance between any pair of equal elements in the array. If no such value exists, return -1. Example arr = [3, 2, 1, 2, 3]; Minimum Distance = 2 (Distance between 2’s)