PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/TikTok

Find the longest palindromic substring

Last updated: May 9, 2026

Quick Overview

This question evaluates proficiency in string manipulation and algorithmic problem-solving, focusing on palindrome detection and substring handling within the Coding & Algorithms domain.

  • easy
  • TikTok
  • Coding & Algorithms
  • Software Engineer

Find the longest palindromic substring

Company: TikTok

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

## Problem Given a string `s`, return the **longest contiguous substring** of `s` that is a **palindrome** (reads the same forward and backward). ## Input - `s`: a non-empty string of length `n` ## Output - A substring of `s` that is the longest palindrome. If multiple answers exist, return any one. ## Constraints - `1 ≤ n ≤ 2000` - `s` contains ASCII letters/digits (you may assume no spaces). ## Examples - Input: `"babad"` → Output: `"bab"` (or `"aba"`) - Input: `"cbbd"` → Output: `"bb"`

Quick Answer: This question evaluates proficiency in string manipulation and algorithmic problem-solving, focusing on palindrome detection and substring handling within the Coding & Algorithms domain.

Related Interview Questions

  • Parse a nested list from a string - TikTok (medium)
  • Implement stacks, streaming median, and upward path sum - TikTok (easy)
  • Maximize sum with no adjacent elements - TikTok (medium)
  • Implement stack variants and path-sum check - TikTok (medium)
  • Solve common string/DP/stack problems - TikTok (medium)
TikTok logo
TikTok
Feb 12, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
5
0
Coding Console
Loading...

Problem

Given a string s, return the longest contiguous substring of s that is a palindrome (reads the same forward and backward).

Input

  • s : a non-empty string of length n

Output

  • A substring of s that is the longest palindrome. If multiple answers exist, return any one.

Constraints

  • 1 ≤ n ≤ 2000
  • s contains ASCII letters/digits (you may assume no spaces).

Examples

  • Input: "babad" → Output: "bab" (or "aba" )
  • Input: "cbbd" → Output: "bb"

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More TikTok•More Software Engineer•TikTok Software Engineer•TikTok Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ 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.