mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 19:31:42 +08:00
add leetcode problem-cn part3
This commit is contained in:
34
算法题(国内版)/problem (Chinese)/有序队列 [orderly-queue].html
Normal file
34
算法题(国内版)/problem (Chinese)/有序队列 [orderly-queue].html
Normal file
@@ -0,0 +1,34 @@
|
||||
<p>给定一个字符串 <code>s</code> 和一个整数 <code>k</code> 。你可以从 <code>s</code> 的前 <code>k</code> 个字母中选择一个,并把它加到字符串的末尾。</p>
|
||||
|
||||
<p>返回 <em>在应用上述步骤的任意数量的移动后,字典上最小的字符串 </em>。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "cba", k = 1
|
||||
<strong>输出:</strong>"acb"
|
||||
<strong>解释:</strong>
|
||||
在第一步中,我们将第一个字符(“c”)移动到最后,获得字符串 “bac”。
|
||||
在第二步中,我们将第一个字符(“b”)移动到最后,获得最终结果 “acb”。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "baaca", k = 3
|
||||
<strong>输出:</strong>"aaabc"
|
||||
<strong>解释:
|
||||
</strong>在第一步中,我们将第一个字符(“b”)移动到最后,获得字符串 “aacab”。
|
||||
在第二步中,我们将第三个字符(“c”)移动到最后,获得最终结果 “aaabc”。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= k <= S.length <= 1000</code></li>
|
||||
<li><code>s</code> 只由小写字母组成。</li>
|
||||
</ul>
|
Reference in New Issue
Block a user