1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最长回文串 [longest-palindrome].html

37 lines
1016 B
HTML
Raw Normal View History

2022-03-27 20:56:26 +08:00
<p>给定一个包含大写字母和小写字母的字符串<meta charset="UTF-8" />&nbsp;<code>s</code>&nbsp;,返回&nbsp;<em>通过这些字母构造成的 <strong>最长的回文串</strong></em>&nbsp;</p>
<p>在构造过程中,请注意 <strong>区分大小写</strong> 。比如&nbsp;<code>"Aa"</code>&nbsp;不能当做一个回文字符串。</p>
<p>&nbsp;</p>
<p><strong>示例 1: </strong></p>
<pre>
<strong>输入:</strong>s = "abccccdd"
<strong>输出:</strong>7
<strong>解释:</strong>
我们可以构造的最长的回文串是"dccaccd", 它的长度是 7。
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong>s = "a"
2023-12-09 18:42:21 +08:00
<strong>输出:</strong>1
2022-03-27 20:56:26 +08:00
</pre>
2023-12-09 18:42:21 +08:00
<p><strong>示例 3</strong></p>
2022-03-27 20:56:26 +08:00
<pre>
2023-12-09 18:42:21 +08:00
<strong>输入:</strong>s = "aaaaaccc"
<strong>输出:</strong>7</pre>
2022-03-27 20:56:26 +08:00
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 2000</code></li>
2023-12-09 18:42:21 +08:00
<li><code>s</code>&nbsp;只由小写 <strong>和/或</strong> 大写英文字母组成</li>
2022-03-27 20:56:26 +08:00
</ul>