You are given a string s consisting only of lowercase English letters. Your task is to transform this string into a palindrome using the minimum number of adjacent swaps.
In one move, you can select any two adjacent characters of s and swap them. For example, in the string "abc", you can swap 'a' and 'b' to get "bac", or swap 'b' and 'c' to get "acb".
Goal: Return the minimum number of moves needed to make s a palindrome.
Note: The input will always be generated such that s can be converted to a palindrome (meaning each character appears an even number of times, or at most one character appears an odd number of times).
Example: For s = "aab", we need 2 moves: "aab" โ "aba" (swap positions 1 and 2) requires 1 move, making it a palindrome with 1 total move.
Input & Output
Constraints
- 1 โค s.length โค 2000
- s consists only of lowercase English letters
- s can always be converted to a palindrome (guaranteed by problem statement)