Minimum Satellite Data Transfer Iterations
Reported by candidates from HSBC's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
HSBC reported this one in August 2026, and the name hides a classic tree problem. Strip the satellite story and you're scheduling broadcasts down a rooted tree where each node can call only one child per round. That's the minimum broadcast time problem, solved with a post-order DFS and a sort. If you have the OA in a day or two, this is the shape to recognize. StealthCoder sits invisibly on your screen as a safety net if the recurrence slips away mid-assessment, but the logic below is short enough to hold in your head.
The problem
A space organization has numSatellite satellites with IDs from 0 to numSatellite - 1. Satellite 0 initially has a data packet that must reach every satellite. The directed pairs in connections form a tree rooted at satellite 0. For each pair [sender, receiver], sender may transfer the data directly to receiver. Transfer model During one iteration, every satellite that had the data at the start of that iteration may transfer it to at most one direct child that does not yet have it. All transfers selected for an iteration finish together at the end of that iteration. A satellite that receives the data may begin forwarding it in the next iteration. A satellite may send again in later iterations until all of its direct children have received the data. Each satellite has at most maxSatellites direct children. You may choose the order in which every satellite contacts its children. Return the minimum number of iterations needed for all satellites to receive the data. Function minimumDataTransferIterations(numSatellite: int, connections: int[][], maxSatellites: int) → int Examples Example 1 numSatellite = 2 connections = [[0,1]] maxSatellites = 1 return = 1 Satellite 0 transfers the data to satellite 1 in the first iteration. Example 2 numSatellite = 6 connections = [[0,1],[0,2],[1,3],[1,4],[3,5]] maxSatellites = 2 return = 3 One optimal schedule is: Satellite 0 sends to 1. Satellite 0 sends to 2, while 1 sends to 3. Satellite 1 sends to 4, while 3 sends to 5. All satellites have the data after three iterations. Example 3 numSatellite = 5 connections = [[0,1],[0,2],[0,3],[0,4]] maxSatellites = 4 return = 4 Satellite 0 can transfer to only one child per iteration. It therefore needs four iterations to contact all four children. Constraints 2 <= numSatellite <= 10^4 connections.length == numSatellite - 1 Every connection is a two-element array [sender, receiver] with distinct IDs in the range 0 through numSatellite - 1. The directed connections form a tree rooted at satellite 0, so every other satellite is reachable exactly once. 1 <= maxSatellites < numSatellite Every satellite has at most maxSatellites direct children.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick: for each node, compute the time to finish its whole subtree. Recurse into the children first. Sort the children's finish times in descending order. The child you contact first starts at round 1, the second at round 2, and so on. So the node's answer is the max over i (1-indexed) of i + childTime[i], with the largest subtree going first. A leaf returns 0. The answer is the root's value. The common pitfall is contacting children in input order, or sorting ascending, which gives wrong answers on Example 2. Another is recursion depth: with up to 10^4 nodes, a chain can overflow the stack in some languages, so use an iterative post-order or raise the limit. Build an adjacency list from connections and ignore maxSatellites for the logic, since it's only a bound. StealthCoder is your hedge in the live OA if you blank on the sort-and-index recurrence. Complexity is O(n log n).
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Minimum Satellite Data Transfer Iterations 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 StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass HSBC's OA.
HSBC 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.
Minimum Satellite Data Transfer Iterations FAQ
What's the trick in Minimum Satellite Data Transfer Iterations?+
Treat it as a tree DP. Each node's time is the max of (rank + child subtree time), where children are sorted by subtree time descending and rank starts at 1. Contact the slowest subtree first so its long tail overlaps with the later sends.
Why sort descending instead of ascending?+
A child contacted later starts later, so any delay adds to its subtree time. Putting the biggest subtree first means its long finish time gets the smallest added delay. Ascending order pushes the heaviest branch to the end and inflates the max.
Does maxSatellites change the algorithm?+
No. It's only a guarantee on how many children any node has. The recurrence works the same for any child count. You never need it in the calculation, so don't build special cases around it.
How do I verify my solution against the examples?+
Example 3 is a star with four leaves, so the root's answer is 4 (ranks 1 to 4, all leaf times 0). Example 2 gives 3: node 3 has time 1, node 1 sorts [1,0] giving max(1+1, 2+0)=2, and the root sorts [2,0] giving max(1+2, 2+0)=3.
How do I prepare for this in 48 hours?+
Write the post-order DFS once from scratch, then test it on the three examples. Practice an iterative version too, since a chain of 10^4 nodes can overflow the recursion stack. Know the complexity is O(n log n) from sorting children.