Answer lelo!! Sliding window approach for the code
\n# Approach\n Describe your approach to solving the problem. \nInitialization:\n\n- k is the total number of 1s in the array. This is because we want to group 
\n# Approach\n<!-- Describe your approach to solving the problem. -->\n**Initialization:**\n\n- k is the total number of 1s in the array. This is because we want to group all 1s together.\n- mx (maximum number of 1s in any window of length k) and cnt (current count of 1s in the first window) are initialized to the number of 1s in the first window of size k.\n\n**Sliding Window:**\n\n- We use a sliding window technique to count the number of 1s in every possible window of size k as we slide the window from the beginning of the list to the end.\n\n- for i in range(k, n + k): This loop is used to slide the window from the beginning of the list to the end, wrapping around the end of the list to simulate a circular array.\n\n- cnt += nums[i % n]: Adds the value of the new element entering the window from the right side.\n\n- cnt -= nums[(i - k + n) % n]: Subtracts the value of the element leaving the window from the left side.\n\n- mx = max(mx, cnt): Updates the maximum count of 1s found in any window of size k.\n\n**Result Calculation:**\n\n- Finally, return k - mx calculates the minimum number of swaps required. This is because k is the total number of 1s, and mx is the maximum number of 1s we can group together without any swap. Therefore, k - mx gives the number of 1s that are not in the best position, which equals the number of swaps needed.\n\n# Example\n    nums = [0,1,0,1,1,0,0]\n\n1. Count of 1s (k):\n\n- k = 3 (there are three 1s in the list).\n\n2. Initial Window Calculation:\n\n- The initial window of size k (first 3 elements): [0,1,0].\n- Number of 1s in this window: cnt = 1.\n- mx is initialized to 1.\n\n**Sliding Window:**\n\n- Slide the window and calculate the number of 1s for each window of size k:\n    1. Window [1,0,1] (indices 1 to 3): cnt = 2, update mx to 2.\n    2. Window [0,1,1] (indices 2 to 4): cnt = 2, no change to mx.\n    3. Window [1,1,0] (indices 3 to 5): cnt = 2, no change to mx.\n    4. Window [1,0,0] (indices 4 to 6): cnt = 1, no change to mx.\n\n**Calculate Minimum Swaps:**\n\n- k - mx = 3 - 2 = 1.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(N)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution:\n    def minSwaps(self, nums: List[int]) -> int:\n        k = nums.count(1)\n        mx = cnt = sum(nums[:k])\n        n = len(nums)\n        for i in range(k, n + k):\n            cnt += nums[i % n]\n            cnt -= nums[(i - k + n) % n]\n            mx = max(mx, cnt)\n        return k - mx\n```
['Array', 'Sliding Window', 'Python3']