Minimum Distance Between Two Elements in an Array