Reported July 2025
Together AIbacktracking

Find GPU Capacity and Drain a Node

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

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

The mistake that sinks most first attempts at this Together AI question, reported in July 2025, is trusting a greedy placement for the displaced pods. Example 2 is built to punish it. You compute free GPUs per node, find which nodes fit a new pod, then delete a node and re-home its pods without touching anyone else. It's tagged graph, but it's really bin packing with backtracking on a tiny input. If you blank mid-assessment, StealthCoder runs invisibly as a safety net and gives you the search order while you keep typing.

The problem

You manage a cluster of GPU nodes. Node i has name nodeNames[i] and total capacity nodeGpus[i]. Pod j has name podNames[j], requires podGpuRequirements[j] GPUs, and currently runs on node index podNodeIndices[j].
First, consider a new pod that requires newPodRequiredGpus GPUs. Compute every node whose current free capacity can fit that request.
Then delete the node named deleteNodeName. Its running pods become displaced and must be assigned to the remaining nodes without moving any pod that already runs on a remaining node.
For this exercise, assume rescheduling must succeed whenever any capacity-feasible assignment exists. A greedy dead end is not proof of impossibility. Explore displaced pods by descending GPU requirement, breaking ties by their original order. For each pod, try remaining nodes in their original input order. Choose the first complete assignment found by this exact search, and report assignments in the displaced pods' original order.
Required result
Return exactly two rows:
The eligibility row contains nodeName:freeGpus for every node that can fit the new request before deletion, in node input order.
The rescheduling row contains podName:nodeName for every displaced pod, in original pod order. If no complete assignment exists, this row is exactly ["IMPOSSIBLE"].

Function
analyzeGpuCluster(nodeNames: String[], nodeGpus: int[], podNodeIndices: int[], podNames: String[], podGpuRequirements: int[], newPodRequiredGpus: int, deleteNodeName: String) → List<List<String>>

Examples
Example 1
nodeNames = ["node-1","node-2","node-3","node-4","node-5"]
nodeGpus = [8,8,8,8,8]
podNodeIndices = [0,0,1,1,2,3,3]
podNames = ["pod-a","pod-b","pod-c","pod-d","pod-e","pod-f","pod-g"]
podGpuRequirements = [2,4,4,4,4,2,2]
newPodRequiredGpus = 2
deleteNodeName = "node-2"
return = [["node-1:2","node-3:4","node-4:4","node-5:8"],["pod-c:node-3","pod-d:node-4"]]
Before deletion, the free capacities are 2, 0, 4, 4, 8, so every node except node-2 can fit the 2-GPU request. Deleting node-2 displaces two 4-GPU pods. In search order, pod-c fits first on node-3 and pod-d fits first on node-4.
Example 2
nodeNames = ["node-a","node-b","node-gone"]
nodeGpus = [8,6,14]
podNodeIndices = [2,2,2]
podNames = ["pod-big","pod-left","pod-right"]
podGpuRequirements = [6,4,4]
newPodRequiredGpus = 7
deleteNodeName = "node-gone"
return = [["node-a:8"],["pod-big:node-b","pod-left:node-a","pod-right:node-a"]]
Putting the 6-GPU pod on node-a first would strand one 4-GPU pod. Exact search backtracks and puts it on node-b, leaving all 8 GPUs on node-a for the two 4-GPU pods.
Example 3
nodeNames = ["left","right","gone"]
nodeGpus = [3,3,4]
podNodeIndices = [2]
podNames = ["wide"]
podGpuRequirements = [4]
newPodRequiredGpus = 3
deleteNodeName = "gone"
return = [["left:3","right:3"],["IMPOSSIBLE"]]
Both remaining nodes can fit the independent 3-GPU request, but neither can fit the displaced 4-GPU pod, so complete rescheduling is impossible.

Constraints
1 <= nodeNames.length <= 12 and all node names are unique.
nodeGpus.length == nodeNames.length and every capacity is between 1 and 64.
podNodeIndices.length == podNames.length == podGpuRequirements.length <= 60, and pod names are unique.
Every pod index is valid, every pod requires between 1 and 64 GPUs, and current usage never exceeds a node's capacity.
deleteNodeName names exactly one node, and at most 10 pods run on it.
1 <= newPodRequiredGpus <= 64.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Part one is simple. Free capacity is nodeGpus minus the sum of pod requirements on that node. Keep nodes where free >= newPodRequiredGpus, output in input order, and compute this before deletion. Part two is backtracking. Collect pods on the deleted node (at most 10), sort by GPU requirement descending with ties by original index, then recurse. For each pod, try remaining nodes in original order, subtract capacity, recurse, and undo on failure. The first complete assignment wins. The pitfall is stopping at the first fit without backtracking, which fails Example 2 where pod-big must go to node-b. Another trap is forgetting to output assignments in original pod order after searching in sorted order. Also don't include the deleted node as a target, and use remaining free capacity, not total capacity. With 10 pods and 11 nodes, plain recursion is fine. If the search runs out of options, return exactly ["IMPOSSIBLE"]. StealthCoder is the hedge if the recursion won't come together live.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Find GPU Capacity and Drain a Node 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Together AI reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find GPU Capacity and Drain a Node FAQ

What's the trick in the Together AI GPU drain problem?+

Backtracking, not greedy. Sort displaced pods by GPU need descending, try nodes in input order, and undo the placement when a later pod can't fit. Example 2 exists to break greedy. The first complete assignment found by that exact order is your answer.

How do I compute which nodes fit the new pod?+

For each node, subtract the sum of its pods' GPU requirements from its capacity. If free is at least newPodRequiredGpus, output nodeName:free. Do this before deleting anything, and keep node input order. Nodes with zero free just don't qualify.

Will brute-force backtracking be fast enough?+

Yes. At most 10 pods run on the deleted node and at most 11 nodes remain, so the search space is small. Sorting by descending requirement prunes early. You don't need memoization or fancy graph algorithms to pass.

What output order do I use for the rescheduling row?+

Search in sorted order, but report in original pod order. Store the chosen node per pod index, then loop over the displaced pods by original index and emit podName:nodeName. Mixing these up is an easy way to fail hidden tests.

How do I prepare for this in 48 hours?+

Write a clean backtracking template for assignment problems: choose, recurse, undo. Then test it on the three examples, especially Example 2 and the IMPOSSIBLE case. Also check edge cases like a deleted node with no pods, which should give an empty rescheduling row.

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

OA at Together AI?
Invisible during screen share
Get it