×

# Longest palindromic substring in the given string?

 0 Can anyone explain how do we find the longest palindromic sub string of in the given string. I know this is the standard DP problem, so please provide the proper DP explanation including overlapping sub-problems and optimal substructure, recursive solution and also what do we need to memorize. asked 14 Sep '17, 14:53 1★arpit728 683●18●68 accept rate: 10%

 0 Well, if you only want the dp solution, You may refer This article. It explains in detail the basic state, transition and filling up the dp array. But there are better approach for this problem, like here with same time complexity, but improved space complexity here. If you want a really faster approach, like for string with length greater than 1000, you would like to have a look at manacher's algorithm, a linear time algorithm for your prob here. Hope this helps.... Please Upvote if u find this hepful.... answered 14 Sep '17, 21:45 4.0k●31●103 accept rate: 22%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,664
×643
×235
×133

question asked: 14 Sep '17, 14:53

question was seen: 942 times

last updated: 14 Sep '17, 21:45