1 Star 0 Fork 18

Gui/力扣题库(完整版)

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
find-smallest-letter-greater-than-target.html 1.44 KB
Copy Edit Raw Blame History
小墨 authored 2022-03-29 12:55 +08:00 . update
<p>Given a characters array <code>letters</code> that is sorted in <strong>non-decreasing</strong> order and a character <code>target</code>, return <em>the smallest character in the array that is larger than </em><code>target</code>.</p>
<p><strong>Note</strong> that the letters wrap around.</p>
<ul>
<li>For example, if <code>target == &#39;z&#39;</code> and <code>letters == [&#39;a&#39;, &#39;b&#39;]</code>, the answer is <code>&#39;a&#39;</code>.</li>
</ul>
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input:</strong> letters = [&quot;c&quot;,&quot;f&quot;,&quot;j&quot;], target = &quot;a&quot;
<strong>Output:</strong> &quot;c&quot;
</pre>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input:</strong> letters = [&quot;c&quot;,&quot;f&quot;,&quot;j&quot;], target = &quot;c&quot;
<strong>Output:</strong> &quot;f&quot;
</pre>
<p><strong>Example 3:</strong></p>
<pre>
<strong>Input:</strong> letters = [&quot;c&quot;,&quot;f&quot;,&quot;j&quot;], target = &quot;d&quot;
<strong>Output:</strong> &quot;f&quot;
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>2 &lt;= letters.length &lt;= 10<sup>4</sup></code></li>
<li><code>letters[i]</code> is a lowercase English letter.</li>
<li><code>letters</code> is sorted in <strong>non-decreasing</strong> order.</li>
<li><code>letters</code> contains at least two different characters.</li>
<li><code>target</code> is a lowercase English letter.</li>
</ul>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/guihaowe/leetcode-problemset.git
git@gitee.com:guihaowe/leetcode-problemset.git
guihaowe
leetcode-problemset
力扣题库(完整版)
master

Search