mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
国外版
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<p>Given a string <code>s</code>. In one step you can insert any character at any index of the string.</p>
|
||||
|
||||
<p>Return <em>the minimum number of steps</em> to make <code>s</code> palindrome.</p>
|
||||
|
||||
<p>A <b>Palindrome String</b> is one that reads the same backward as well as forward.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "zzazz"
|
||||
<strong>Output:</strong> 0
|
||||
<strong>Explanation:</strong> The string "zzazz" is already palindrome we don't need any insertions.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "mbadm"
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> String can be "mbdadbm" or "mdbabdm".
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "leetcode"
|
||||
<strong>Output:</strong> 5
|
||||
<strong>Explanation:</strong> Inserting 5 characters the string becomes "leetcodocteel".
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 500</code></li>
|
||||
<li><code>s</code> consists of lowercase English letters.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user