If both the minimum and the maximum element has occurred at least once
if ( min_index != - 1 and max_index != - 1 ) : NEW_LINE INDENT min_dist = ( min ( min_dist , abs ( min_index - max_index ) ) ) NEW_LINE DEDENT return min_dist NEW_LINE