Longest Palindromic Substring using Dynamic Programming | C++ code with Animation | Bangla

Опубликовано: 01 Апрель 2026
на канале: CS Inside
412
16

This video tutorial will show you how to find the longest palindromic substring in the given string.

Code: https://drive.google.com/file/d/1_sMl...

The longest palindromic substring problem is the problem of finding a maximum-length contiguous substring of a given string that is also a palindrome
For example, the longest palindromic substring of "google" is "goog".
There are many approaches to solve this problem like dynamic programing, Manacher's algorithm and so on. In this article, we will see how to solve this program with dynamic programming.

We need a memoisation table. Therefore we use a 2D boolean array where the rows represent i, and columns represent j. Let's call this array table[ ][ ], and table[i][j] will store whether the substring from ith position to jth is a palindrome or not. The table will be initialized to false.

Time complexity: O(𝒏^𝟐)

【Other playlists】
Palindrome:    • Palindrome in c | String | Bangla  
String:    • Palindrome in c | String | Bangla  

【Check The Below Links】
INSTAGRAM:   / shanin_hoss​​​.  .
FACEBOOK:   / shanin.hossa​​​.  .
CONTACT: [email protected]
#longest_palindromic_substring #dynamic_programming