HARDasked at 1 company

Minimum Initial Energy to Finish Tasks

A hard-tier problem at 59% community acceptance, tagged with Array, Greedy, Sorting. Reported in interviews at Akuna Capital and 0 others.

Founder's read

You're given an array of tasks, each with an energy cost and reward. The trick: you must complete all tasks in some order without your energy dropping to zero or below at any point. Find the minimum starting energy needed. Akuna Capital has asked this one. It's a greedy sorting problem that looks deceptively simple until you hit the wall and realize the obvious order doesn't work. If you freeze on the logic during the OA, StealthCoder solves it invisibly while you think through the next step.

Companies asking
1
Difficulty
HARD
Acceptance
59%

Companies that ask "Minimum Initial Energy to Finish Tasks"

If this hits your live OA

Minimum Initial Energy to Finish Tasks 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 a senior engineer who knows the OA is theater. This is the script.

Get StealthCoder
What this means

The greedy insight is the trap. You can't just sort by cost descending or reward ascending. The real pattern: sort tasks by the difference between reward and cost in descending order, then simulate backwards from the end. Why backwards? Because you need to calculate the minimum energy required at each task without violating the constraint that energy never dips below 1. Walk through the sorted array in reverse, tracking what starting energy at each step guarantees you survive to the end. Most candidates try forward simulation or a naive sort first and get stuck. The backwards greedy approach with proper sorting is the only clean solution. When this shows up live and you blank on the backwards logic, StealthCoder surfaces the working code in seconds.

Pattern tags

The honest play

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

Minimum Initial Energy to Finish Tasks recycles across companies for a reason. It's hard-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 a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Initial Energy to Finish Tasks interview FAQ

Is this problem actually asked at big tech?+

Not reported at FAANG commonly, but Akuna Capital has it on record. It's a medium-to-hard greedy problem that appears in trading/finance interview loops where optimization under constraints matters. You'll see it in focused prep, not broad drills.

Why can't I just sort by energy cost?+

Because cost alone doesn't tell you the constraint impact. A task with high cost but high reward can be done later safely. A task with low cost and negative reward drains you early. Sorting by the delta (reward minus cost) in descending order ensures you handle the toughest constraint-violators first when your energy buffer is highest.

What's the backward simulation trick?+

After sorting, iterate from the last task backwards. At each step, calculate minimum energy needed before that task to end with at least 1 energy after it. This avoids the forward simulation pitfall where you can't know the global minimum without looking ahead. Backward guarantees correctness.

How hard is the implementation?+

Sorting and simulation are straightforward. The real difficulty is recognizing the greedy sort order and why backwards works. Once you see the pattern, code is 15-20 lines. The algorithm design is the wall, not the execution. Acceptance sits around 59%, mostly from pattern recognition failures.

Will I see this without grinding greedy problems?+

Unlikely unless you study Akuna Capital or trading firm problems specifically. It's not a canonical leetcode problem for most FAANG loops. Prep it if greedy is weak or if you're interviewing at fintech. Otherwise, it's a curveball hedge where StealthCoder is your safety net.

Want the actual problem statement? View "Minimum Initial Energy to Finish Tasks" 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.