Greatest English Letter in Upper and Lower Case LeetCode solution in Python

1
# Runtime: 34 ms (Top 92.91%) | Memory: 13.8 MB (Top 66.80%)
2

3

4
class Solution:
5
def greatestLetter(self, s: str) -> str:
6
cnt = Counter(s)
7
return next(
8
(u for u in reversed(ascii_uppercase) if cnt[u] and cnt[u.lower()]), ""
9
)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0