744. Find Smallest Letter Greater Than Target
https://leetcode.com/problems/find-smallest-letter-greater-than-target/
Python
class Solution:
def nextGreatestLetter(self, letters: List[str], target: str) -> str:
target_ord = ord(target)
for letter in letters:
if ord(letter) > target_ord:
return letter
return letters[0]