Class Solution
java.lang.Object
g0701_0800.s0744_find_smallest_letter_greater_than_target.Solution
744 - Find Smallest Letter Greater Than Target.<p>Easy</p>
<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 == 'z'</code> and <code>letters == ['a', 'b']</code>, the answer is <code>'a'</code>.</li>
</ul>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> letters = [“c”,“f”,“j”], target = “a”</p>
<p><strong>Output:</strong> “c”</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> letters = [“c”,“f”,“j”], target = “c”</p>
<p><strong>Output:</strong> “f”</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> letters = [“c”,“f”,“j”], target = “d”</p>
<p><strong>Output:</strong> “f”</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>2 <= letters.length <= 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>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
nextGreatestLetter
public char nextGreatestLetter(char[] letters, char target)
-