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

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0