Minimum Distance Between Three Equal Elements II Solution
Problem Statement You are given an integer array nums. A triple of indices (i, j, k) is called good if: The distance of a good triple is:∣i−j∣+∣j−k∣+∣k−i∣|i-j| + |j-k| + |k-i|∣i−j∣+∣j−k∣+∣k−i∣ Your task is to return the minimum possible distance among all good triples. If no value appears at least 3 times, return -1. Example … Read more