Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Moves to Make Palindrome

Minimum Number of Moves to Make Palindrome asks you to transform a string into a palindrome using swaps of any two adjacent characters, then return the fewest moves required.

Statement

Given a string s, return the minimum number of moves required to transform s into a palindrome. In each move, you can swap any two adjacent characters in s.

Note: The input string is guaranteed to be convertible into a palindrome.

Constraints:

  • 1≤1 \le s.length ≤2000\le 2000

  • s consists of only lowercase English letters.

  • s is guaranteed to be converted into a palindrome in a finite number of moves.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number of Moves to Make Palindrome

Minimum Number of Moves to Make Palindrome asks you to transform a string into a palindrome using swaps of any two adjacent characters, then return the fewest moves required.

Statement

Given a string s, return the minimum number of moves required to transform s into a palindrome. In each move, you can swap any two adjacent characters in s.

Note: The input string is guaranteed to be convertible into a palindrome.

Constraints:

  • 1≤1 \le s.length ≤2000\le 2000

  • s consists of only lowercase English letters.

  • s is guaranteed to be converted into a palindrome in a finite number of moves.