2022-03-27 20:46:41 +08:00
|
|
|
|
<p>给你一个字符串 <code>s</code> ,请你统计并返回这个字符串中 <strong>回文子串</strong> 的数目。</p>
|
|
|
|
|
|
|
|
|
|
<p><strong>回文字符串</strong> 是正着读和倒过来读一样的字符串。</p>
|
|
|
|
|
|
|
|
|
|
<p><strong>子字符串</strong> 是字符串中的由连续字符组成的一个序列。</p>
|
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p><strong class="example">示例 1:</strong></p>
|
2022-03-27 20:46:41 +08:00
|
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong>s = "abc"
|
|
|
|
|
<strong>输出:</strong>3
|
|
|
|
|
<strong>解释:</strong>三个回文子串: "a", "b", "c"
|
|
|
|
|
</pre>
|
|
|
|
|
|
2025-01-09 20:29:41 +08:00
|
|
|
|
<p><strong class="example">示例 2:</strong></p>
|
2022-03-27 20:46:41 +08:00
|
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong>s = "aaa"
|
|
|
|
|
<strong>输出:</strong>6
|
|
|
|
|
<strong>解释:</strong>6个回文子串: "a", "a", "a", "aa", "aa", "aaa"</pre>
|
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>1 <= s.length <= 1000</code></li>
|
|
|
|
|
<li><code>s</code> 由小写英文字母组成</li>
|
|
|
|
|
</ul>
|