1class Solution {2public char slowestKey(int[] releaseTimes, String keysPressed) {3int max = releaseTimes[0];4char ch = keysPressed.charAt(0);5for (int i = 1; i < releaseTimes.length; i++) {6int diff = releaseTimes[i] - releaseTimes[i - 1];7if (diff >= max) {8if (diff > max) ch = keysPressed.charAt(i);9else if (diff == max) ch = (char) Math.max((int) ch, (int) keysPressed.charAt(i));10max = diff;11}12}13return ch;14}15}