mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
30 lines
688 B
HTML
30 lines
688 B
HTML
<p>给你一个字符串 <code>s</code>,找到 <code>s</code> 中最长的回文子串。</p>
|
||
|
||
<p>如果字符串的反序与原始字符串相同,则该字符串称为回文字符串。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>s = "babad"
|
||
<strong>输出:</strong>"bab"
|
||
<strong>解释:</strong>"aba" 同样是符合题意的答案。
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>s = "cbbd"
|
||
<strong>输出:</strong>"bb"
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= s.length <= 1000</code></li>
|
||
<li><code>s</code> 仅由数字和英文字母组成</li>
|
||
</ul>
|