public String greatestLetter(String s) {
Set<Character> ht = new HashSet<Character>();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
ht.add(c);
}
for (int i = 25; i >= 0; i--) {
if (ht.contains((char) ('a' + i)) && ht.contains((char) ('A' + i))) {
return String.valueOf((char) ('A' + i));
}
}
return "";
}
2023.1.27-----leetcode.2309
猜你喜欢
转载自blog.csdn.net/weixin_60466670/article/details/128772992
今日推荐
周排行