The Employee That Worked on the Longest Task
A easy-tier problem at 51% community acceptance, tagged with Array. Reported in interviews at Morgan Stanley and 1 others.
You're prepping for Morgan Stanley or IBM, and this one's in the mix. The Employee That Worked on the Longest Task looks deceptively simple on the surface, find which employee spent the most time on a single task and return their ID. With a 50% acceptance rate, it's the kind of problem that trips up candidates who overthink it or misread the input format. If you blank on the exact logic during your live assessment, StealthCoder catches it in seconds and surfaces a working solution invisible to the proctor.
Companies that ask "The Employee That Worked on the Longest Task"
The Employee That Worked on the Longest Task 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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround.
Get StealthCoderThe trap here is the input structure. You're typically given task logs as strings or arrays, and you need to parse them to calculate task durations, then track which employee had the longest single task. The obvious approach is to iterate through logs, extract employee ID and duration, and track the maximum. Where candidates falter: they skip proper parsing, confuse total time vs. single task max, or return the wrong data type. Some also assume sorted input or miss edge cases like ties (return the smallest ID). Since this is Array-focused, a clean pass through the data with proper bookkeeping is all you need. If the parsing or comparison logic snaps during your OA and you're stuck, StealthCoder runs the solution instantly under the radar.
Pattern tags
You know the problem.
Make sure you actually pass it.
The Employee That Worked on the Longest Task 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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround. Works on HackerRank, CodeSignal, CoderPad, and Karat.
The Employee That Worked on the Longest Task interview FAQ
Is this problem still asked at Morgan Stanley and IBM?+
Yes. It appears in their online assessments and is reported by candidates from both companies. The 50% acceptance rate suggests it's weeding out candidates who skip the parsing step or return the wrong format. It's a real blocker if you're not careful with input handling.
What's the actual trick to solving this quickly?+
Parse the logs cleanly in one pass. Extract employee ID and task duration, track the maximum duration and the corresponding employee ID. If there's a tie, return the smallest ID. That's it. No fancy data structures needed. The trick is not overcomplicating it.
How much time should I spend on this during an OA?+
If you've seen the pattern before, 5 to 7 minutes. If the input format surprises you, you might spend 10 to 12 minutes debugging the parsing. That's when you'd want StealthCoder to hand you the working code and move on.
Is this really an 'Easy' problem?+
The logic is easy. Execution is where the 50% acceptance rate bites. If you're sloppy with parsing, string handling, or off-by-one comparisons, you'll fail test cases. Easy doesn't mean careless.
Does this problem require knowing any advanced algorithms?+
No. It's pure Array manipulation. You need a single pass through the data and proper variable tracking. If you're overthinking it as a sorting or DP problem, step back and re-read the problem statement.
Want the actual problem statement? View "The Employee That Worked on the Longest Task" on LeetCode →