2808. Minimum Seconds to Equalize a Circular Array
You are given a 0-indexed array
numscontainingnintegers.At each second, you perform the following operation on the array:
- For every index
iin the range[0, n - 1], replacenums[i]with eithernums[i],nums[(i - 1 + n) % n], ornums[(i + 1) % n].Note that all the elements get replaced simultaneously.
Return the minimum number of seconds needed to make all elements in the array
numsequal.
1 | class Solution { |