FastPrepDelivery Origins and Reachable Destinations
Problems/Delivery Origins and Reachable Destinations

Delivery Origins and Reachable Destinations

Atlassian logoAtlassian● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The directed cart-route task and original destination memberships match the source at about 90%; this practice assumes acyclic routes and sorts rows and destinations.

An automated robot factory ships packages along one-way cart routes. Each pair [from, to] in paths is a route from one named location to another. The routes never loop back, so they form a directed acyclic graph.

An origin is a location that no route leads into. A destination is a location that no route leads out of. For each origin, find every destination it can reach by following one or more routes.

Return one row per origin. The row starts with the origin, then lists each destination it can reach, once. Sort the rows by origin, and sort the destinations inside each row. Both sorts are lexicographic (plain string order).

The locations are exactly the names that appear in paths. The same pair may appear more than once, but a destination is still listed only once. If paths is empty, return an empty list.

Function

deliveryDestinations(paths: String[][]) → String[][]

Examples

Example 1

paths = [["B","K"],["C","K"],["E","L"],["F","G"],["J","M"],["E","F"],["C","G"],["A","B"],["A","C"],["G","H"],["G","I"]]return = [["A","H","I","K"],["E","H","I","L"],["J","M"]]

The origins are A, E and J. A reaches H, I and K. E reaches H, I and L. J reaches M. The rows and the destinations in each row are in lexicographic order.

Example 2

paths = [["start","a"],["start","b"],["a","end"],["b","end"]]return = [["start","end"]]

The only origin is start. It reaches end through a and also through b. The destination end is listed once, so the answer has one row.

Example 3

paths = [["A","B"],["C","D"]]return = [["A","B"],["C","D"]]

The two routes are not connected. A is an origin that reaches B, and C is an origin that reaches D, so each gets its own row.

Constraints

  • 0 <= paths.length <= 500, with at most 300 different locations.
  • Every path has exactly two location names, and no name is empty. The routes never form a loop.
  • Each location name has 1 to 30 ASCII letters or digits. Names are case-sensitive.

More Atlassian Phone Screen questions

  • Merge Overlapping IntervalsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Tennis Court SchedulingPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Implement a Rate LimiterPHONE SCREEN · Seen Oct 2026
  • Longest Consistent Activity StreakPHONE SCREEN · Seen Sep 2026
  • Music Player Operation SequencePHONE SCREEN · Seen Sep 2026
  • Underline Shortest Unique SubstringsPHONE SCREEN · Seen Aug 2026
  • Can a Dictionary Word Be Formed from Note Letters?PHONE SCREEN · Seen Feb 2026
  • Word Path Moving Only Right or DownPHONE SCREEN · Seen Feb 2026
  • Ordered Badge Entry and Exit ViolationsPHONE SCREEN · Seen Aug 2025
  • Two Sum with an Ordered Index PairPHONE SCREEN · Seen Aug 2025

Similar questions at other companies

  • Task Build Order and File-Change RerunsVanta · PHONE SCREEN
  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • All Halfway Courses Across Course TracksCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Course Schedule Cycle DetectionGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Course ScheduleNykaa · PHONE SCREENNykaa interview questions
  • Effective Role PrivilegesSnowflake · PHONE SCREENSnowflake interview questions
  • Course ScheduleBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Course Schedule FeasibilityTesla · PHONE SCREENTesla interview questions
  • Least-Strong Common DefeaterConfluent · PHONE SCREENConfluent interview questions
  • Course ScheduleOracle · ONSITE INTERVIEWOracle interview questions

Interview reports that mention this question

  • Atlassian Full Stack Interviews: 11 Experiences (Part 1 of 2)

Atlassian interview experiences

  • Atlassian MLE Phone Screen: Model Deployment Design: 1 Experience
  • Atlassian Coding Screens and Karat: 3 Experiences (Part 2 of 2)
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public String[][] deliveryDestinations(String[][] paths) {
        // Write your code here.
        return new String[0][];
    }
}
Checking account…