PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Find longest palindromic substring

Last updated: Mar 29, 2026

Quick Overview

This question evaluates knowledge of string algorithms and pattern recognition, focusing on identifying palindromic substrings and reasoning about time and space complexity for contiguous substring problems.

  • medium
  • Meta
  • Coding & Algorithms
  • Machine Learning Engineer

Find longest palindromic substring

Company: Meta

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Given a string `s`, return the **longest contiguous substring** of `s` that is a **palindrome**. ## Input - A single string `s`. ## Output - A string representing the longest palindromic substring (if multiple answers exist, return any one). ## Constraints - `1 <= len(s) <= 2000` (or similar typical interview constraints) - `s` contains ASCII letters/digits. ## Examples - `s = "babad"` → `"bab"` (or `"aba"`) - `s = "cbbd"` → `"bb"`

Quick Answer: This question evaluates knowledge of string algorithms and pattern recognition, focusing on identifying palindromic substrings and reasoning about time and space complexity for contiguous substring problems.

Related Interview Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
Meta logo
Meta
Nov 28, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
4
0
Loading...

Given a string s, return the longest contiguous substring of s that is a palindrome.

Input

  • A single string s .

Output

  • A string representing the longest palindromic substring (if multiple answers exist, return any one).

Constraints

  • 1 <= len(s) <= 2000 (or similar typical interview constraints)
  • s contains ASCII letters/digits.

Examples

  • s = "babad" → "bab" (or "aba" )
  • s = "cbbd" → "bb"

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Machine Learning Engineer•Meta Machine Learning Engineer•Meta Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.