Longest Palindromic Substring
A Quick Overview
Problem Statement
Given a string, we have to find the longest palindromic substring. Substring is a sequence of characters that is contiguous within a string.
Learn More
Example:
Input: findnitianhere
Output: indni
Explanation: Substring from index 1 to 5 is longest substring.
Check out other Examples
Find all the substrings from a string that are possible, and determine whether or not they are palindromes.
Simple Approach
Learn More
Time complexity:
O(N^3), where N is string size.
Space complexity:
O(1)
Learn More
How to implement Simple approach in different programming languages?
Find Out Here
Efficient Approach: Dynamic Programming
Identify some patterns in validating palindromes to avoid unnecessary re-computation and improve brute force methods by memorizing the data.
Learn More
Time complexity:
O(N^2), where N is string size
Space complexity:
O(N^2)
Learn More
How to implement these approaches in different programming languages?
Find Out Here