Practice Find Smallest Letter Greater Than Target
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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.
Source: Find Smallest Letter Greater Than Target on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
letters = ["c","f","j"], target = "a"
"c"
# Example 2
letters = ["c","f","j"], target = "c"
"f"
# Example 3
letters = ["x","x","y","y"], target = "z"
"x"
Constraints
Related LeetCode Problems
Practice more problems similar to Find Smallest Letter Greater Than Target.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.