FastPrepFind a Directed Resource Access Path
Problems/Find a Directed Resource Access Path

Find a Directed Resource Access Path

CoreWeave logoCoreWeave● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a CoreWeave phone screen. The report gives directed pairs of resource access, an example of reaching a resource, returning an actual path, and walks through the graph. It leaves out what to return when a resource is unreachable, how to break ties between paths, access to itself, and the limits. Our version is about 95% the same as the reported question.

Each row [a, b] in access means resource a can directly access resource b. Access is directed.

Return one shortest directed path from source to target, including both endpoints. If several shortest paths exist, process each resource’s outgoing neighbors in the order their pairs appear in access; return the path first discovered by breadth-first search. Duplicate pairs do not change the result.

If target is unreachable, return an empty array. If source == target, return [source].

Function

findAccessPath(access: int[][], source: int, target: int) → int[]

Examples

Example 1

access = [[1,2],[2,3]]source = 1target = 3return = [1,2,3]

Resource 1 reaches 3 through resource 2.

Example 2

access = [[1,2],[1,3],[2,4],[3,4]]source = 1target = 4return = [1,2,4]

Two paths have two edges. Because pair [1, 2] appears before [1, 3], breadth-first search discovers the path through resource 2 first.

Example 3

access = [[5,6],[6,7],[8,5]]source = 7target = 5return = []

The graph contains a path from 5 to 7, but directed access does not imply a path in the reverse direction.

Constraints

  • 0 <= access.length <= 200000.
  • Every row of access contains exactly two resource IDs.
  • Resource IDs, source, and target are integers in [0, 10^9].
  • Self-loops and duplicate directed pairs may appear.
  • The graph may contain cycles.

More CoreWeave Phone Screen questions

  • Filter Data with Composable PredicatesPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Find Minimum City HopsAmazon · OA
  • Shortest Route Through a Traced MazeDuolingo · OADuolingo interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Shortest Pin Path Through TopicsPinterest · PHONE SCREENPinterest interview questions
  • Shortest Travel Time in a Grid with Traffic LightsWaymo · PHONE SCREENWaymo interview questions
  • Word Chain Jumps in a GridGoogle · PHONE SCREENGoogle interview questions
  • Shortest Word Chain Between Two WordsFanatics · PHONE SCREEN
  • Route Graph Reachability with a Broken LinkFigma · PHONE SCREENFigma interview questions
  • Minimum Currency ConversionsEPAM · PHONE SCREENEPAM interview questions
  • Finite Web CrawlerMongoDB · PHONE SCREEN · ONSITE INTERVIEWMongoDB interview questions

CoreWeave interview experiences

  • CoreWeave Infra SWE Phone Screen in Go: 1 Experience
See CoreWeave hiring insights
Saved
class Solution {
    public int[] findAccessPath(int[][] access, int source, int target) {
        // Write your code here.
    }
}
Checking account…