simple and easy C++ solution 😍❤️‍🔥
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook: www.fb.com/shishirrsiam\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minSwaps(vector<int>& oky) \n    {\n        vector<int> nums = oky;\n        int oneCount = 0, n = nums.size();\n        for(int i = 0; i < n; i++)\n        {\n            oneCount += nums[i];\n            nums.push_back(oky[i]);\n        }\n\n        int ans = INT_MAX, i = 0, j = 0, windowOneCount = 0 ;\n        while(j < oneCount)\n            windowOneCount += nums[j++];\n        ans = min(ans, oneCount - windowOneCount);\n\n        while(j < n + n)\n        {\n            if(nums[j++]) windowOneCount++;\n            if(nums[i++]) windowOneCount--;\n            ans = min(ans, oneCount - windowOneCount);\n        }\n        return ans;\n    }\n};\n```
['Array', 'Sliding Window', 'C++']