Python | with explanation
\n"""https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/"""\nclass Solution:\n    def minSwaps(self, s: str) -> int:\n        clo
```\n"""https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/"""\nclass Solution:\n    def minSwaps(self, s: str) -> int:\n        close,maxClose=0,0\n        for i in s:\n            if i=="[":\n                close-=1\n            else:\n                close+=1\n            maxClose=max(close,maxClose)\n        return (maxClose+1)//2 # we will do this because swapping 1 close brackets neutralizes one more. Example:- ]][[, if we swap ONE ] bracket, it will become [][], so it neutralizes TWO , so we will divide our maxCLose by TWO by ADDING one because we need ONE operation of swapping\n    \n# SUBMISSION REPORT:-\n    # Runtime: 875 ms, faster than 55.02% of Python3 online submissions for Minimum Number of Swaps to Make the String Balanced.\n    # Memory Usage: 25.5 MB, less than 54.09% of Python3 online submissions for Minimum Number of Swaps to Make the String Balanced.\n    \n# EXPLANATION\n    # We will take two varibales close and maxclose\n    # We will iterate through the array and if the element is opening backet, we will decrement close, else increment close\n    # Lastly, we will store the maximum number of closes in maxClose variable\n    # We will return the answer with some modifications explained above\n    \n# VIDEO EXPLANATION:-\n    # https://www.youtube.com/watch?v=3YDBT9ZrfaU&t=699s\n```
['Python', 'Python3']