Skip to content

Practice Minimum Insertion Steps to Make a String Palindrome

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#1312
LeetCode Problem

Minimum Insertion Steps to Make a String Palindrome

Problem Statement

Given a string s. In one step you can insert any character at any index of the string. Return the minimum number of steps to make s palindrome. A Palindrome String is one that reads the same backward as well as forward.

Source: Minimum Insertion Steps to Make a String Palindrome on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "zzazz"
Output
0

# Example 2

Input
s = "mbadm"
Output
2

# Example 3

Input
s = "leetcode"
Output
5

Constraints

1 <= s.length <= 500
s consists of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Minimum Insertion Steps to Make a String Palindrome.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.