Minimum Insertions to Make a Palindrome
Problem statement
Return the minimum number of single-character insertions needed to turn text into a palindrome. Insertions may occur at any positions.
Function
minInsertionsPalindrome(text: String) → intExamples
Example 1
text = "apple"return = 3Three insertions suffice; equivalently, apple has a longest palindromic subsequence of length 2.
Constraints
0 <= text.length <= 2000.- The text contains lowercase English letters.