Math Homework

Reported by candidates from Superhuman's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Superhuman OA. Under 2s to a working solution.
Founder's read

You're taking Superhuman's OA in April 2026 and hit Math Homework. You start at index 0, can move forward 1 or 2 steps, and stop when max minus min points across solved problems hits a threshold. If it never does, solve everything. The trick is that you're not optimizing for points or time. You're optimizing for the minimum count of problems while forcing a spread. This is a constrained path problem wearing a math costume.

The problem

A student must solve the first problem at index 0. After solving a problem at index i, the student may solve either the next problem i + 1 or skip one problem and solve i + 2. The student continues until the difference between the maximum and minimum point values among the solved problems is at least threshold. If that can never be achieved, the student must solve all problems. Return the minimum number of problems the student needs to solve. Function Description Complete the function minProblemsToSolve in the editor below. minProblemsToSolve has the following parameters: Returns

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern here is dynamic programming with a state that tracks (current index, min value seen, max value seen, problem count). You can't just greedily jump ahead because the spread requirement is global across all solved problems, not local. Most candidates miss that you need to explore multiple paths from index 0 and track both the minimum and maximum point values simultaneously. The trick is that once max minus min exceeds threshold, you can stop immediately and return the count. If you exhaust all problems without hitting it, return the total. StealthCoder will catch the state-space definition the moment you blank on whether to track min/max or just count.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Math Homework cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as jump game ii. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Superhuman's OA.

Superhuman reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Math Homework FAQ

Is this actually DP or just greedy with math?+

It's DP. Greedy fails because the spread constraint is global. You need to explore paths and memoize on (index, min_value, max_value, count) or similar. The math is just the threshold comparison. The algorithm is the hard part.

Do I have to solve problems in order or can I jump around?+

You start at 0 and can only move forward 1 or 2 steps. No backward jumps, no arbitrary reordering. It's a linear path with controlled skip options.

What if the threshold is impossible to hit?+

The problem says you must solve all problems if the threshold can never be achieved. Your base case is: if you reach the end of the array without hitting the spread, return the total count of problems solved.

How do I optimize this in 30 minutes if I blank?+

Write a recursive function that tracks (index, min_seen, max_seen, count). Check if max minus min exceeds threshold before recursing. Memoize on the state. If it's slow, prune branches where count is already too high. StealthCoder will give you the structure.

Does the point value matter or just the count?+

Both. The point values determine when the spread threshold is met. The count is what you return. You're not trying to maximize points. You're using them as a signal to stop counting as soon as spread is achieved.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Superhuman.

OA at Superhuman?
Invisible during screen share
Get it