---
# System prepended metadata

title: 2309. Greatest English Letter in Upper and Lower Case
tags: [Leetcode, Easy]

---

# 2309. Greatest English Letter in Upper and Lower Case
###### tags: `Leetcode` `Easy`
Link: https://leetcode.com/problems/greatest-english-letter-in-upper-and-lower-case/description/
## 思路
character转成string: ```Character.toString()```
```'a'```-```'z'```,```'A'```-```'Z'```的最大值小于128
## Code
```java=
class Solution {
    public String greatestLetter(String s) {
        boolean[] cnt = new boolean[128];
        for(int i=0; i<s.length(); i++) cnt[s.charAt(i)] = true;
        for(char c='Z'; c>='A'; c--){
            if(cnt[c] && cnt[c-'A'+'a']) return Character.toString(c);
        }
        return "";
    }
}
```