java.lang.Object
g0001_0100.s0005_longest_palindromic_substring.Solution

public class Solution extends Object
5 - Longest Palindromic Substring.<p>Medium</p> <p>Given a string <code>s</code>, return <em>the longest palindromic substring</em> in <code>s</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s = &ldquo;babad&rdquo;</p> <p><strong>Output:</strong> &ldquo;bab&rdquo; <strong>Note:</strong> &ldquo;aba&rdquo; is also a valid answer.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s = &ldquo;cbbd&rdquo;</p> <p><strong>Output:</strong> &ldquo;bb&rdquo;</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> s = &ldquo;a&rdquo;</p> <p><strong>Output:</strong> &ldquo;a&rdquo;</p> <p><strong>Example 4:</strong></p> <p><strong>Input:</strong> s = &ldquo;ac&rdquo;</p> <p><strong>Output:</strong> &ldquo;a&rdquo;</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= s.length <= 1000</code></li> <li><code>s</code> consist of only digits and English letters.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • longestPalindrome

      public String longestPalindrome(String s)