Small Business Network: Degrees of Separation
Reported by candidates from Intuit's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The mistake that sinks a first attempt on this Intuit OA, reported in May 2026, is treating the relationships as directed edges. They're undirected, and one missed reverse edge turns a correct-looking BFS into wrong answers. The problem is called Small Business Network: Degrees of Separation, and it's a shortest path on an unweighted graph. You get a list of business pairs, a source, and a target. Return one shortest path, endpoints included. If nothing connects them, return an empty array. If source equals target, return just that business. If you blank mid-assessment, StealthCoder runs invisibly as a safety net and hands you the BFS skeleton.
The problem
QuickBooks stores business relationships between companies. Each relationship connects two businesses, and relationships should be treated as undirected graph edges. Given the relationship list, a source business, and a target business, return one shortest relationship path from source to target. The path should include both endpoints. If no relationship path exists, return an empty array. If source is the same as target, return an array containing only that business. Function shortestBusinessPath(relationships: String[][], source: String, target: String) → String[] Examples Example 1 relationships = [["A", "B"], ["B", "C"]] source = "A" target = "C" return = ["A", "B", "C"] The relationships form A <--> B <--> C, so the shortest path from A to C goes through B. Example 2 relationships = [["A", "B"], ["C", "D"]] source = "A" target = "D" return = [] A and D are in different connected components, so there is no relationship path. Constraints Each entry in relationships contains exactly two business names. Relationship edges are undirected. If multiple shortest paths exist, returning any one shortest path is acceptable.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is breadth-first search with parent tracking. Build an adjacency map from the relationships, adding both directions for every pair. Start a queue at the source, mark it visited, and store a parent for each node as you discover it. When you pop the target, walk the parent pointers back to the source and reverse the result. BFS guarantees the first time you reach the target is via a shortest path, so no distance bookkeeping is needed. Pitfalls: forgetting the reverse edge, forgetting the visited set and looping forever on cycles, and missing the source equals target case before the loop. Also handle a target that never appears in any relationship, which should return an empty array, not crash on a missing map key. If the live OA has you freezing on path reconstruction, StealthCoder is the hedge that shows the parent-map pattern on screen without the proctor seeing it.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Small Business Network: Degrees of Separation 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Intuit's OA.
Intuit reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Small Business Network: Degrees of Separation FAQ
How hard is the Intuit Degrees of Separation question really?+
It's a standard medium. The graph is unweighted, so BFS is the whole algorithm. The only extra step is rebuilding the path from parent pointers. If you've written BFS once, you can finish this quickly. Edge cases cause most of the failures.
What's the trick to getting the path, not just the distance?+
Store a parent map as you enqueue neighbors. Set parent[neighbor] = current the moment you first discover it. When you reach the target, follow parents back to the source, collect the nodes, and reverse the list. That gives one valid shortest path.
Why not use DFS here?+
DFS finds a path, not necessarily the shortest one. On an unweighted graph, BFS explores level by level, so the first arrival at the target is guaranteed shortest. DFS would need extra tracking and could be much slower or simply wrong.
What edge cases should I test before submitting?+
Test source equals target, which returns an array with one business. Test disconnected components, which return an empty array. Test a target missing from every relationship. Test cycles, like A-B, B-C, C-A, to confirm your visited set stops infinite loops.
How do I prepare for this in 48 hours?+
Write BFS on an adjacency map from scratch twice, once returning distance and once returning the path. Practice building the undirected map from a list of pairs. Then run the two examples from the problem and your own disconnected case. That covers this pattern.