✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\nTime complexity: O(n). Space complexity: O(1).\n
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\nTime complexity: $$O(n)$$. Space complexity: $$O(1)$$.\n```\nclass Solution:\n    def minSwaps(self, a: List[int]) -> int:\n        return (n:=len(a),o:=sum(a),w:=sum(a[:o])) and o-max(w:=w-a[i]+a[(i+o)%n] for i in range(n))\n```
['Array', 'Sliding Window', 'Python', 'Python3']