All Questions
Tagged with dynamic-programming palindrome
7 questions
1
vote
2
answers
165
views
Making my DP algorithm faster - longest palindromic substring
The following code is my solution to a LeetCode question - find the longest palindromic substring. My code is 100% correct, it passed once but it took too long, and in most of the reruns I hit a "...
3
votes
1
answer
266
views
Longest Palindromic Substring | Python Code Giving TLE
Problem Statement
Given a string s , return the longest palindromic substring in s.
Constraints
...
9
votes
1
answer
2k
views
LeetCode on Longest Palindromic Substring in Python
This is a programming question from LeetCode:
Given a string s, return the longest palindromic substring in s.
Example 1:
Input: s = "babad" Output: "bab" Note: "aba" is ...
1
vote
0
answers
128
views
How do I optimize memoization in order to find longest palindromic substring?
I want to find the longest palindromic substring using dynamic programming in Python3. The strings can be as large as this string.
I have seen other questions on this problem that successfully solve ...
3
votes
0
answers
229
views
Longest Palindrome Substring: Where is the dynamic programming? [closed]
In this LeetCode problem, Longest Palindromic Substring, it is listed under Dynamic Programming for Google interview preparation. My understanding of dynamic programming is roughly "recursion + ...
6
votes
2
answers
2k
views
Length of longest palindrome subsequence
I had an interview, where I was asked to solve to this question:
Given an string str, find the maximum length of palindrome subsequence.
Example: >if str = 'abcda':
maximum_length = 3 'aca'
How ...
3
votes
2
answers
881
views
Longest Common Subsequence and Longest Subsequence Palindrome
The following code computes:
The longest common subsequence between two strings, where a subsequence of a sequence does not have to consist of contiguous elements of the sequence.
The longest ...