Mark As Completed Discussion

Longest Palindromic Substring

I have a sister named "Maham". For my cousins and I, her name was fascinating, as it is the same spelling if we read it backwards and forwards.

Later on, as I grew up, I came to know that this interest is a problem in the field of Computer Science. Yes, you guessed it right, I'm talking about the study of palindromes.

In Computer Science, the palindrome problem has always been tricky. We have to find a solution for a word that reads the same backward as read forward keeping the solution optimized. Don’t worry ,once you’ll get the concept, it will become easy for you to deal with any problem related to palindromes.

A Journey

We will take you on a journey where you will learn about the longest palindromic substring. A palindromic substring is a substring which is a palindrome. Let’s say that we have a string ‘"Maham"’-- the longest palindromic substring would be ‘"aha"’. For the function signature, we will pass a simple string as a parameter. Our program should give us an output that will display the longest palindromic substring of the input string.

Let’s dig deeper into it.