Reported April 2026
Superhumangreedy

Optimal Transfer

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

Superhuman's April OA hits you with a graph connectivity problem dressed as server capacity distances. You're given server capacities, and distance between any two servers is the absolute difference in their capacities. Each server knows its single closest neighbor. You need to answer multiple queries about minimum cost to connect pairs of servers using allowed operations. The trick is recognizing this as a greedy union-find problem, not a shortest-path search. StealthCoder reads the problem on screen and feeds you the pattern in real time if you blank on the approach.

The problem

The distance between server i and server j is |capacity[i] - capacity[j]|. For each server, its closest server is the one with the smallest distance in capacity, and that closest server is guaranteed to be unique. You may perform either of the following operations from a server x: Given query arrays fromServer and toServer, compute the minimum cost required to connect from fromServer[i] to toServer[i] for each query. A path may be direct or may route through intermediate servers. Function Description Complete the function minimumTransferCost in the editor below. minimumTransferCost has the following parameters: Returns

Reported by candidates. Source: FastPrep

Pattern and pitfall

The problem wraps a greedy graph-building exercise in server language. Since each server has a unique closest neighbor by capacity distance, you can build edges greedily. The key insight: operations let you connect servers, so you're really tracking which servers can reach which others through a growing connectivity graph. Use union-find (disjoint set union) to group servers into connected components as you build edges. For each query, check if fromServer and toServer are in the same component and compute the cost of the path. The greedy part is that the closest-neighbor structure is already given. Don't overthink shortest paths between all pairs. Build the graph incrementally, union the components, and answer reachability. StealthCoder gives you the union-find template if the live OA makes you second-guess whether to use DSU or Dijkstra.

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 Optimal Transfer 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

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as number of connected components in an undirected graph. 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. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Optimal Transfer FAQ

Is this a shortest-path problem or a connectivity problem?+

Connectivity. The problem is asking you to compute minimum cost to connect pairs of servers, not shortest distances between them. The closest-neighbor structure is pre-determined by capacity. Use union-find to track which servers are reachable, not BFS or Dijkstra.

What does 'closest server' mean here?+

For each server i, the closest server is the one with the smallest absolute difference in capacity. It's unique by problem guarantee. This isn't something you compute. It's a property of the input data. Use it to build your initial edges.

Do I need to find actual paths or just check connectivity?+

The problem asks for minimum cost, which implies you need to track the cost of connecting each pair in a query. Once servers are in the same component, the cost is determined by the edges used. Precompute component membership and edge costs.

Can I solve this in 48 hours with no DSU experience?+

Yes. Union-find is a 20-minute pattern. Google 'union-find with path compression' and implement find and union. Then build edges greedily using closest neighbors, union the endpoints, and answer queries by checking if two servers share a root.

What's the trick that Superhuman expects me to see?+

Recognize that the problem gives you the edge structure (closest neighbors) and asks you to compute connectivity, not paths. Greedy union-find beats any dynamic shortest-path approach. The problem is simpler than it reads.

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