3386. Button with Longest Push Time
You are given a 2D array
events
which represents a sequence of events where a child pushes a series of buttons on a keyboard.Each
events[i] = [indexi, timei]
indicates that the button at indexindexi
was pressed at timetimei
.
- The array is sorted in increasing order of
time
.- The time taken to press a button is the difference in time between consecutive button presses. The time for the first button is simply the time at which it was pressed.
Return the
index
of the button that took the longest time to push. If multiple buttons have the same longest time, return the button with the smallestindex
.
1 | func buttonWithLongestTime(events [][]int) int { |