Given a lowercase alphabet string s, find the minimum number of swaps required to make it a
symmetry string. If it's not possible, then return -1.
Constraints:
n ≤ 1,000 where n is length of s.
Example 1
Input
s = "aabb"
Output
2
Explanation
We can swap the middle "a" and "b" and then swap the first two "a" and "b" to get
"baab".
Example 2
Input
s = "aab"
Output
1
Explanation
We can swap the middle "a" and "b" to get "aba".
Example 3
Input
s = "abca"
Output
-1
Explanation
No Possibilities.
Answers
Answered by
0
Answer:
go and ask your friends and students and students and teachers
Similar questions
Social Sciences,
18 days ago
Math,
18 days ago
Science,
18 days ago
Math,
1 month ago
Science,
8 months ago