EASYasked at 1 company

Button with Longest Push Time

A easy-tier problem at 41% community acceptance, tagged with Array. Reported in interviews at J.P. Morgan and 0 others.

Founder's read

You're staring at an array of button press durations and need to find which one took the longest. Sounds trivial. Then you realize the catch: the input format is weird, the edge cases bite, and you're burning interview minutes on something that should take 30 seconds. J.P. Morgan has asked this. The acceptance rate sits around 40%, which tells you people are stumbling on the implementation, not the concept. If you blank on how to parse the input or handle the output format during your live OA, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
EASY
Acceptance
41%

Companies that ask "Button with Longest Push Time"

If this hits your live OA

Button with Longest Push Time is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.

Get StealthCoder
What this means

This is an array traversal problem dressed up as a timing challenge. The real trick isn't the algorithm, it's the input/output contract. You'll likely get button labels and their press times in some format (pairs, tuples, or split arrays), and you need to return the label of the button with the maximum duration. The obvious loop works fine, but candidates miss the format requirements: returning the right data type, handling ties correctly if they occur, or correctly parsing the input structure. The 40% acceptance rate reflects sloppy implementations, not algorithmic complexity. During the assessment, if you're unsure about the exact format expected or second-guessing the comparison logic, StealthCoder eliminates that friction by showing the correct solution instantly.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Button with Longest Push Time recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Button with Longest Push Time interview FAQ

Why is the acceptance rate only 40% if this is an easy problem?+

It's easy algorithmically but punishes sloppy implementation. Candidates often get the max logic right but fail on input parsing, output format, or edge cases like empty arrays. The format friction is where most mistakes happen, not the actual algorithm.

What's the actual trick to this problem?+

There isn't one algorithmically. It's a single pass through the array with a max comparison. The trick is reading the problem statement carefully so you return exactly what's asked: the button label, not the time, not an index, not both.

Is this still asked by J.P. Morgan or has it rotated out?+

J.P. Morgan has reported asking it. We can't confirm current rotation, but it remains in their problem pool. If your OA includes array problems, this type of question is live enough to prepare for.

How does this relate to harder array problems?+

It's a building block. Max/min traversal with custom comparison logic shows up in more complex problems like finding peak elements or tracking state across iterations. Nailing this format now saves debugging time later.

What happens if two buttons have the same press time?+

The problem statement should specify (return first, last, or any). If it's unclear, your solution needs to handle it predictably. Re-read the spec and test both scenarios before submitting during your OA.

Want the actual problem statement? View "Button with Longest Push Time" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.