Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Create 1312-Minimum-Insertion-Steps-to-Make-a-String-Palindrome.py#4342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Yatin-aggarwal wants to merge1 commit intoneetcode-gh:main
base:main
Choose a base branch
Loading
fromYatin-aggarwal:patch-1

Conversation

Yatin-aggarwal
Copy link

@Yatin-aggarwalYatin-aggarwal commentedJul 6, 2025
edited
Loading

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 freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@Yatin-aggarwal

[8]ページ先頭

©2009-2025 Movatter.jp