3936. Minimum Swaps to Move Zeros to End
You are given an integer array
nums.In one operation, you can choose any two distinct indices
iandjand swapnums[i]andnums[j].Return an integer denoting the minimum number of operations required to move all 0s to the end of the array.
1 | class Solution { |