[Python3, Java, C++] Easy Sliding Window O(n)
Intuition:  \nWhenever you are faced with a circular array question, you can just append the array to itself to get rid of the circular array part of the proble
*Intuition*:  \nWhenever you are faced with a circular array question, you can just append the array to itself to get rid of the circular array part of the problem\n\n***Explanation***:\n* Count number of ones in nums, let the number of ones be stored in the variable `ones`\n* Append nums to nums because we have to look at it as a circular array\n* Find the maximum number of ones in a window of size `ones` in the new array\n* Number of swaps = `ones` - maximum number of ones in a window of size `ones`\n<iframe src="https://leetcode.com/playground/kCYY9jmQ/shared" frameBorder="0" width="600" height="300"></iframe>\n\nWe can also solve the same in O(1) space. Loop through the array twice:\n```\ndef minSwaps(self, nums: List[int]) -> int:\n\tones, n = nums.count(1), len(nums)\n\tx, onesInWindow = 0, 0\n\tfor i in range(n * 2):\n\t\tif i >= ones and nums[i % n - ones]: x -= 1\n\t\tif nums[i % n] == 1: x += 1\n\t\tonesInWindow = max(x, onesInWindow)\n\treturn ones - onesInWindow\n```
['C', 'Java', 'Python3']