#3740
Minimum Distance Between Three Equal Elements I
pupil · 385 · lc easy +24 · 60.5% accepted · 59 likes · top 59%
Description
Given an integer array nums, return the minimum value of abs(i - j) + abs(j - k) + abs(k - i) over all triples of distinct indices where nums[i] == nums[j] == nums[k], or -1 if no such triple exists.
Code
1
2
3