👍Runtime 161 ms Beats 100.00%
Code\n\nfunc minimumSeconds(nums []int) int {\n\tmapIndex := make(map[int]int)\n\tmapDist := make(map[int]int)\n\tn := len(nums)\n\t\n\tfor i := 0; i < 2 * n; i
# Code\n```\nfunc minimumSeconds(nums []int) int {\n\tmapIndex := make(map[int]int)\n\tmapDist := make(map[int]int)\n\tn := len(nums)\n\t\n\tfor i := 0; i < 2 * n; i++ {\n\t\tcurr := nums[i % n]\n\t\t\n\t\tif val, exists := mapIndex[curr]; exists && val != i {\n\t\t\tmaxDist := i - val\n\t\t\tif val > i {\n\t\t\t\tmaxDist = n + val - i\n\t\t\t}\n\t\t\t\n\t\t\tif _, existsDist := mapDist[curr]; !existsDist || maxDist > mapDist[curr] {\n\t\t\t\tmapDist[curr] = maxDist\n\t\t\t}\n\t\t}\n\t\tmapIndex[curr] = i\n\t}\n\t\n\tres := math.MaxInt32\n\tfor _, dist := range mapDist {\n\t\tres = int(math.Min(float64(res), float64(dist / 2)))\n\t}\n\treturn res\n}\n```
['Go']