Given a binary circular array nums, you may perform swaps of any two elements in nums. Return the minimum number of swaps needed to make all values equal to 1 appear in a single contiguous block (considering the circular wrap around).
Note: Since
numsis circular, a contiguous block of1s may wrap from the end of the array to the beginning.
Constraints:
nums.length
nums[i] is either
Given a binary circular array nums, you may perform swaps of any two elements in nums. Return the minimum number of swaps needed to make all values equal to 1 appear in a single contiguous block (considering the circular wrap around).
Note: Since
numsis circular, a contiguous block of1s may wrap from the end of the array to the beginning.
Constraints:
nums.length
nums[i] is either