Hard · Strings

Minimum Insertions to Form a Palindrome

Given an ASCII string s, return the minimum number of characters that must be inserted (at any positions) to make s a palindrome.

Examples

Example 1

{
  "s": "notebook"
}

Output: 5 insertions

Example 2

{
  "s": "mbadm"
}

Output: 2 insertions

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Strings problems