Longest Palindromic Substring

RedAurtherRedAurther
1 min read

🧠 Problem

Longest Palindromic Substring


🏷️ Tags

string, Dynamic Programming


📊 Difficulty

Medium

✅ Success Rate: 31.8%
📥 Submissions: 5,618,701
📈 Accepted: 1,784,028


❤️ Reactions

👍 Likes: 17097
👎 Dislikes: 1005


💡 Hints

How can we reuse a previously computed palindrome to compute a larger palindrome? If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome? Complexity based hint: If we use brute-force and check whether for every start and end position a substring is a palindrome we have O(n^2) start - end pairs and O(n) palindromic checks. Can we reduce the time for palindromic checks to O(1) by reusing some previous computation.


🔁 Similar Questions

  • Shortest Palindrome
  • Palindrome Permutation
  • Palindrome Pairs
  • Longest Palindromic Subsequence
  • Palindromic Substrings

Leetcode Link : Longest Palindromic Substring

0
Subscribe to my newsletter

Read articles from RedAurther directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

RedAurther
RedAurther