You're given a string s containing English letters (both uppercase and lowercase). Your task is to find the greatest English letter that appears in both uppercase and lowercase forms within the string.
The "greatest" letter means the one that comes latest in the alphabet (e.g., 'Z' > 'Y' > 'X'). If you find such a letter, return it in uppercase. If no letter exists in both forms, return an empty string.
Example: In the string "lEeTcOdE", both 'E' and 'e' are present, so we return "E" (since E is the greatest qualifying letter).
Input & Output
Visualization
Time & Space Complexity
Single pass through the string, each character processed in O(1) time
Set can contain at most 52 characters (26 uppercase + 26 lowercase), which is constant space
Constraints
- 1 โค s.length โค 1000
- s consists of lowercase and uppercase English letters only
- Return the result in uppercase format