Most Intuitive Sliding Window solution 
It was hard to come up with a solution for this, and honestly I failed a few times before I saw a hint and realized what needed to be done.The basic idea of the
It was hard to come up with a solution for this, and honestly I failed a few times before I saw a hint and realized what needed to be done.

The basic idea of the question is to count the number of 1s in the array (say `totalOnesCount`) and then to "Find the window if size `totalOnesCount` containing the maximum number of 1s (i.e. window with minimum 0s)". Once you understand this, the question is easy to solve.

Below are a few salient points for coming up with this solution:

1. Since the array is circular, we iterate from 0 to `len + totalOnesCount -1` to find that window.
2. The sliding window is of a fixed length `totalOnesCount`. 
3. Once we maximize 1s in a given window, we automatically minimize the number of 0s in that window and hence we minimize the number of swaps.
4. Use modulo operator to not exceed the array boundaries.

Here is a summary of the solution below:
1. Count the total number of 1s in the array. Let's call it `totalOnesCount`.
2. Create `currOnesCount` to keep track of 1s in the current window of length `totalOnesCount` and initialize to 0.
3. Create `res` to keep track of the minimum number of swaps.
4. Iterate from index 0 to `len + totalOnesCount - 1` since the 1s could be wrapped around.
5. Add the current number to `currOnesCount`.
6. If the size of the window is less than `totalOnesCount`, continue.
7. If the size of the window is equal to `totalOnesCount`, update `res`, while removing the first number from the window. Note that the new size of the window is  `totalOnesCount - 1` currently, but it'll be `totalOnesCount` in the next iteration.
8. Return `res`.

# Code
```java []
class Solution {
    public int minSwaps(int[] nums) {
        int len = nums.length, totalOnesCount = 0;
        // Count the number of 1's
        for (int num : nums) {
            totalOnesCount += num;
        }
        int currOnesCount = 0, res = Integer.MAX_VALUE;
        // len+totalOnesCount for circular array
        for (int i = 0; i < len + totalOnesCount; i++) {
            // Add the current element
            currOnesCount += nums[i % len];
            // If the window size is less than totalOnesCount, continue
            if (i < totalOnesCount - 1) {
                continue;
            }
            // Update res
            res = Math.min(res, totalOnesCount - currOnesCount);
            // Remove the first element from the window
            currOnesCount -= nums[(i - totalOnesCount + 1) % len];
        }
        return res;
    }
}
```
['Java']