You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are given a binary string, s, consisting of characters 'O' and '1'. Transform this string into a palindrome by performing some operations. In one operation, swap any two characters, [l) and s[j]. Determine the minimum number of swaps required to make the string a palindrome. If it is impossible to do so, then return -1.
Note: A palindrome is a string that reads the same backward as forward, for example, strings
"O", "111", "010", "10101" are palindromes, but strings "001", "10", "11101" are not.