Longest Palindromic Subsequence

medium
Unit 12 · Dynamic Programming II0/3 to milestone

A subsequence keeps order but may skip characters. Return the length of the longest palindromic subsequence of s using interval DP (O(n²) time).

Also implement min_insertions(s): the minimum number of characters to insert anywhere to make s a palindrome (hint: it's related).

#dynamic-programming#strings2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Longest Palindromic Subsequence · TechGradify