Smallest Letter Greater Than Target

L5 Medium Binary Search
Concept
Binary search works on any ordered sequence; characters are no exception. For wrapping sequences, if no match is found, the answer wraps to the first element.
Given a string letters of sorted lowercase letters (duplicates allowed) and a single-character target, return the smallest character in letters that is strictly greater than target. If none exists, wrap around and return the first character.
Examples
▸ letters = "cfj", target = "a"
→ c
▸ letters = "cfj", target = "c"
→ f
▸ letters = "xxyy", target = "z"
→ x
Progressive Hints
Hint 1 · Nudge
Only the first character that strictly surpasses target matters, with wrap-around at the end.
Hint 2 · Plan
Binary search for the first index whose character is greater than target. If the search runs off the end, wrap around and return the first character.
Hint 3 · Approach
Binary search for the first index i where letters[i] > target. Return letters[i], or letters[0] when the search ends past the last index.
Output
// Run your code to see the output here.