1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 19:18:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/寻找比目标字母大的最小字母 [find-smallest-letter-greater-than-target].html

43 lines
1.3 KiB
HTML
Raw Normal View History

2022-03-27 20:46:41 +08:00
<p>给你一个排序后的字符列表 <code>letters</code> ,列表中只包含小写英文字母。另给出一个目标字母&nbsp;<code>target</code>,请你寻找在这一有序列表里比目标字母大的最小字母。</p>
<p>在比较时,字母是依序循环出现的。举个例子:</p>
<ul>
<li>如果目标字母 <code>target = 'z'</code> 并且字符列表为&nbsp;<code>letters = ['a', 'b']</code>,则答案返回&nbsp;<code>'a'</code></li>
</ul>
<p>&nbsp;</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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 &lt;= letters.length &lt;= 10<sup>4</sup></code></li>
<li><code>letters[i]</code>&nbsp;是一个小写字母</li>
<li><code>letters</code> 按非递减顺序排序</li>
<li><code>letters</code> 最少包含两个不同的字母</li>
<li><code>target</code> 是一个小写字母</li>
</ul>