Skip to content

Conversation

Yatin-aggarwal
Copy link

@Yatin-aggarwal Yatin-aggarwal commented Jul 6, 2025

Description:

This PR adds a solution to LeetCode Problem 1312 using a top-down dynamic programming approach with memoization.The goal is to return the minimum number of insertions required to make the input string a palindrome.

Approach:
We use recursion with memoization (top-down DP) to avoid redundant computations.

The key idea:

If characters at both ends match, move inward.

Else, insert one character and recursively solve for both possible substrings (excluding one character from either end), and take the minimum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant