Grokking Oracle Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Longest Palindromic Substring (medium)
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

Given a string s, return the longest palindromic substring in s.

A string is called palindromic if it reads same from forward as backward.

A substring is a contiguous sequence of characters in the string.

Examples

  • Example 1:

    • Input: s = "racecar"
    • Expected Output: "racecar"
    • Justification: The entire string is a palindrome and is the longest substring.
  • Example 2:

    • Input: s = "abccd"
    • Expected Output: "cc"
    • Justification: The longest palindromic substring is "cc" in the string abccd.
  • Example 3:

    • Input: s = "xyzzy"
    • Expected Output: "yzzy"
    • Justification: The substring "yzzy" is the longest palindromic substring.

Try it yourself

Try solving this question here:

Python3
Python3

. . . .

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible