mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 19:18:14 +08:00
43 lines
1.3 KiB
HTML
43 lines
1.3 KiB
HTML
<p>给你一个排序后的字符列表 <code>letters</code> ,列表中只包含小写英文字母。另给出一个目标字母 <code>target</code>,请你寻找在这一有序列表里比目标字母大的最小字母。</p>
|
||
|
||
<p>在比较时,字母是依序循环出现的。举个例子:</p>
|
||
|
||
<ul>
|
||
<li>如果目标字母 <code>target = 'z'</code> 并且字符列表为 <code>letters = ['a', 'b']</code>,则答案返回 <code>'a'</code></li>
|
||
</ul>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入: </strong>letters = ["c", "f", "j"],target = "a"
|
||
<strong>输出:</strong> "c"
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong> letters = ["c","f","j"], target = "c"
|
||
<strong>输出:</strong> "f"
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong> letters = ["c","f","j"], target = "d"
|
||
<strong>输出:</strong> "f"
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>2 <= letters.length <= 10<sup>4</sup></code></li>
|
||
<li><code>letters[i]</code> 是一个小写字母</li>
|
||
<li><code>letters</code> 按非递减顺序排序</li>
|
||
<li><code>letters</code> 最少包含两个不同的字母</li>
|
||
<li><code>target</code> 是一个小写字母</li>
|
||
</ul>
|