Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final boolean[] smallest = new boolean[26];
- final boolean[] largest = new boolean[26];
- Arrays.fill(smallest, Boolean.FALSE);
- Arrays.fill(largest, Boolean.FALSE);
- for (final Character c : s.toCharArray()) {
- if (Character.isLowerCase(c)) {
- final int index = c - 'a';
- smallest[index] = true;
- }
- else {
- final int index = c - 'A';
- largest[index] = true;
- }
- }
- for (int i = 25; i >= 0; i--) {
- if (smallest[i] == true && largest[i] == true) {
- final String res = "" + (char)(i + 65);
- return res;
- }
- }
- return "No";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement