Dsa
Strings
Medium
Minimal Palindrome Insertions
Given a string `s`, you need to determine the minimum number of characters that must be inserted into the string to make it a palindrome. A palindrome reads the same forwards and backwards. The output should be the minimum number of insertions required.
### Input Format:
- A single line containing the string `s` (1 <= |s| <= 1000).
### Output Format:
- A single integer representing the minimum number of insertions required.
### Example:
Input:
abc
Output:
2
Explanation: By inserting 'a' at the end and 'b' at the front, the string becomes 'abcba'.
Key concepts
stringspalindromedynamic programming
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now