Easy
,Array
,Binary Search
744. Find Smallest Letter Greater Than Target
You are given an array of characters letters
that is sorted in non-decreasing order, and a character target
. There are at least two different characters in letters
.
Return the smallest character in letters
that is lexicographically greater than target
. If such a character does not exist, return the first character in letters
.
Example 1:
Example 2:
Example 3:
Constraints:
letters.length
<= 104letters[i]
is a lowercase English letter.letters
is sorted in non-decreasing order.letters
contains at least two different characters.target
is a lowercase English letter.Jerry Wu9 June, 2023
Yen-Chi ChenFri, Jun 9, 2023
Ron ChenFri, Jun 9, 2023
與 ChatGPT 來來回回改出來的
Ron ChenFri, Jun 9, 2023