Tap here to switch tabs
Problem
Submissions

Problem: Button with Longest Push Time

med
30 min
Try to solve the Button with Longest Push Time problem.

Statement

You are given a 2extD2 ext{D} integer array events where each events[i] = [index_i, time_i] indicates that the button with index index_i was pressed at time time_i.

The time taken to press the initial button is time_0. For each subsequent button press i>0i > 0, the time taken is calculated as time_i −- time_{i-1}.

Return the index of the button that required the maximum push time. If there is a tie, return the smallest button index.

Constraints:

  • 1≤1 \leq events.length ≤1000\leq 1000

  • events[i] == [index_i, time_i]

  • 1≤1 \leq index_i, time_i ≤105\leq 10^5

  • The input is generated such that events is sorted in increasing order of time_i.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Button with Longest Push Time

med
30 min
Try to solve the Button with Longest Push Time problem.

Statement

You are given a 2extD2 ext{D} integer array events where each events[i] = [index_i, time_i] indicates that the button with index index_i was pressed at time time_i.

The time taken to press the initial button is time_0. For each subsequent button press i>0i > 0, the time taken is calculated as time_i −- time_{i-1}.

Return the index of the button that required the maximum push time. If there is a tie, return the smallest button index.

Constraints:

  • 1≤1 \leq events.length ≤1000\leq 1000

  • events[i] == [index_i, time_i]

  • 1≤1 \leq index_i, time_i ≤105\leq 10^5

  • The input is generated such that events is sorted in increasing order of time_i.