Slowest Key Press
Learn this problemProblem statement
Engineers have redesigned a keypad used by ambulance drivers in urban areas. In order to determine which key takes the longest time to press, the keypad is tested by a driver. Given the results of that test, determine which key takes the longest to press.
Function
slowestKey(keyTimes: int[][]) → char
Complete the function slowestKey in the editor below.
slowestKey has the following parameter(s):
int keyTimes[n][2]: the first column contains the encoded key pressed, the second
𓆝 ⋆.𖦹°‧🫧𓂃Credit to ㄇE𓈒𓇼 ⋆。˚ 𓆝
Examples
Example 1
keyTimes = [[0, 2], [1, 5], [0, 9], [2, 15]]return = c
Elements in keyTimes[i][0] represent encoded characters in the range ascii[a-z] where a = 0, b = 1, ... z = 25. The second element, keyTimes[i][1] represents the time the key is pressed since the start of the test. The elements will be given in ascending time order. In the example, keys pressed, in order are 0[2/encoded] = abcat times 2, 5, 9, 15. From the start time, it took 2 - 0 = 2 to press the first key, 5 - 2 = 3 to press the second, and so on. The longest time it took to press a key was key 2, or 'c', at 15 - 9 = 6.
More JPMorgan Chase problems
- Bitwise XOR SubsequencesOA · Seen Jul 2026
- Array ChallengeOA · Seen Jun 2026
- Minimum Cores to Handle ProcessesOA · Seen Jun 2026
- About ShippingOA · Seen Jun 2026
- Count Dropped RequestsOA · Seen Jan 2026
- Generate Table of ContentsOA · Seen Jan 2026
- Calculate Net ProfitSeen Jun 2025
- Find Total WeightSeen Jun 2025