Given a string S, find the longest palindromic substring in S. Note: This is Part II of the article: Longest Palindromic Substring. Here, we describe an algorithm (Manacher’s algorithm) which finds the longest palindromic substring in linear time. Please read Part I for more background information.

# Category Archives: string

# Longest Palindromic Substring Part I

Given a string S, find the longest palindromic substring in S.

# Regular Expression Matching

Implement regular expression matching with support for ‘.’ and ‘*’.

# Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For “bbbbb” the longest substring is “b”, with the length of 1.

# A String Replacement Problem

Replace all occurrence of the given pattern to ‘X’.For example, given that the pattern=”abc”, replace “abcdeffdfegabcabc” with “XdeffdfegX”. Note that multiple occurrences of abc’s that are contiguous will be replaced with only one ‘X’.

# Implement strstr() to Find a Substring in a String

Write C code to implement the strstr (Search for a substring) function. Do not use any system library such as strlen.