GPU Capacity With Limited Cluster Switching

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

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

Mistral AI reported this one in April 2026, and the data structure you pick decides whether it feels easy or painful. It's a DP table indexed by day, cluster, and switches used. You pick one GPU cluster per day, score capacity minus usage, and you only get a limited number of cluster changes. If your OA invite is sitting in your inbox, this is the shape to recognize. Nobody wants to invent the state at 2 AM. And if you blank mid-assessment, StealthCoder runs invisibly on your desktop and gives you the solution live, so the clock doesn't beat you.

The problem

You operate several GPU clusters for a sequence of days. Cluster c has a fixed capacity capacities[c]. Each row [day, cluster, used] records the GPUs already occupied on that day; an omitted pair has zero usage.
Choose exactly one cluster per day. Its contribution is capacity - used. Moving from one cluster to a different cluster between consecutive days consumes one switch. Return the maximum total remaining GPU capacity obtainable with at most maxSwitches switches.
Every day and cluster pair appears at most once in usages.

Function
maximizeRemainingGpu(capacities: int[], numDays: int, usages: int[][], maxSwitches: int) → int

Examples
Example 1
capacities = [10,8]
numDays = 3
usages = [[0,0,9],[0,1,1],[1,0,0],[1,1,7],[2,0,9],[2,1,0]]
maxSwitches = 1
return = 19
Use cluster 1 on day 0, switch to cluster 0 on day 1, and remain there on day 2 for 7 + 10 + 1 = 18.
Example 2
capacities = [5,9]
numDays = 2
usages = []
maxSwitches = 0
return = 18
With no switches, staying on cluster 1 contributes 9 on each day.

Constraints
1 <= capacities.length <= 50
1 <= numDays <= 200
0 <= maxSwitches < numDays
0 <= used <= capacities[cluster] <= 10000

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is the state: dp[cluster][k] is the best total ending on that cluster after the current day with k switches used. Build a usage lookup first, a 2D array of days by clusters filled from usages, with zeros for omitted pairs. Transition per day: staying gives dp[c][k] + gain, switching gives the best of dp[c'][k-1] for any other c' plus gain. Don't loop over all c' for each cell. Keep the top two values per k so you can exclude the same cluster in O(1). Plain loops cost days * clusters^2 * switches, which is 200 * 2500 * 200 and is borderline. The common pitfall is counting a switch on day 0, or allowing at most versus exactly k. Take the max over all k at the end. If the state design slips under pressure, StealthCoder is the hedge on the live OA.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill GPU Capacity With Limited Cluster Switching 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. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder
⏵ The honest play

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

Mistral AI reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

GPU Capacity With Limited Cluster Switching FAQ

What's the trick in the Mistral AI GPU capacity problem?+

Use DP over day, cluster, and switches used. Each day you either stay on the same cluster at no cost or switch from a different cluster using one switch. Precompute the gain as capacity minus usage in a lookup table, with zero for missing pairs.

How hard is this really?+

Medium to medium-hard. The DP idea is standard, but the switching transition can blow up if you loop over every previous cluster naively. Tracking the best and second-best value per switch count fixes it cleanly.

Do I need to optimize the switch transition?+

Probably yes. With 50 clusters, 200 days, and up to 199 switches, the naive version is around 100 million operations or more. It might pass, but best and second-best per switch count is safer and not much extra code.

What edge cases break solutions?+

Day 0 costs no switch because there's no previous cluster. Missing usage rows mean zero used, so the gain is the full capacity. maxSwitches can be 0, which means you commit to one cluster the whole time. Take the max over all switch counts at the end.

How do I prep for this in 48 hours?+

Write one DP with a count dimension, like stock trading with k transactions. Practice defining the state out loud first, then the transitions. Code this problem from scratch once with a rolling array over days, and test it on both examples.

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

OA at Mistral AI?
Invisible during screen share
Get it