Skip to content

Practice Greatest English Letter in Upper and Lower Case

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2309
LeetCode Problem

Greatest English Letter in Upper and Lower Case

Problem Statement

Given a string of English letters s, return the greatest English letter which occurs as both a lowercase and uppercase letter in s. The returned letter should be in uppercase. If no such letter exists, return an empty string. An English letter b is greater than another letter a if b appears after a in the English alphabet.

Source: Greatest English Letter in Upper and Lower Case on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "lEeTcOdE"
Output
"E"

# Example 2

Input
s = "arRAzFif"
Output
"R"

# Example 3

Input
s = "AbCdEfGhIjK"
Output
""

Constraints

1 <= s.length <= 1000
s consists of lowercase and uppercase English letters.

Related LeetCode Problems

Practice more problems similar to Greatest English Letter in Upper and Lower Case.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.