Skip to main content
All Questions

Find the Longest Palindromic Substring.

Write a brute force solution first, then a variation that returns the lexicographically greater palindrome, then the optimal solution, and explain time and space complexity.

Expect follow-ups like

  • How would you solve a variation asking for the lexicographically greater palindrome?
  • Variation: return the lexicographically greater palindrome.

Format · 60-minute technical round.

Also asked as · Longest Palindromic Substring.; Solve a variation of Longest Palindromic Substring.; Write code for the longest palindromic substring in a string.

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.