Longest Palindrome and Minimum Partitions
Given a string text
, find the longest substring within text
that reads the same forwards and backwards. You can assume that the length of text
will not exceed 1200 characters.
Example 1: Input: "radarlevel" Output: "radar" Note: "level" is also an acceptable answer. Example 2: Input: "forgeeksskeegfor" Output: "geeksskeeg"
text
≤ 1200text
consists of printable ASCII characters.