Easy · Binary Search
Find Smallest Letter Greater Than Target
Given a list of lowercase letters sorted in non-decreasing order and a target letter, return the smallest letter in the list that is strictly greater than the target; if there is no such letter, return the first letter of the list.
Examples
Example 1
['c','f','j'], t='a'Output: 'c'
Example 2
['c','f','j'], t='c'Output: 'f'
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.