744. Find Smallest Letter Greater Than Target
Approach 1: Binary Search using bisect
bisectclass Solution(object):
def nextGreatestLetter(self, letters, target):
"""
:type letters: List[str]
:type target: str
:rtype: str
"""
index = bisect.bisect(letters, target)
return letters[index % len(letters)]Last updated