Java || Greedy || 12ms || beats 99.58% || T.C - O(n) S.C - O(1)
\n    // O(s) O(1)\n\tpublic int minSwaps(String s) {\n\n\t\tint matching = 0;\n\t\tfor (char ch : s.toCharArray()) {\n\t\t\tif (ch == \'[\') {\n\t\t\t\tmatchin
\n    // O(s) O(1)\n\tpublic int minSwaps(String s) {\n\n\t\tint matching = 0;\n\t\tfor (char ch : s.toCharArray()) {\n\t\t\tif (ch == \'[\') {\n\t\t\t\tmatching++;\n\t\t\t} else {\n\t\t\t\tif (matching > 0)\n\t\t\t\t\tmatching--;\n\t\t\t}\n\t\t}\n\t\treturn (matching + 1) / 2;\n\t}
[]