FastPrepAssign Campers to the First Arriving Car
Problems/Assign Campers to the First Arriving Car

Assign Campers to the First Arriving Car

Atlassian logoAtlassian● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time phone screen. The task of two cars, their routes, and the earliest pickup is about 95% the same as the report, including the original roads, passenger names, and output. We chose these: ties go to car 0, the passenger order is fixed, the cars have unlimited capacity, every place can be reached, names are unique, and the input limits.

Two cars leave their starting locations at time zero and drive to Campground. Each row of roads is [origin, destination, duration], where duration is a decimal string of travel minutes. Each location has at most one outgoing road, routes have no cycles or detours, and both cars follow their routes without waiting.

starts gives the two starting locations. Each row of people is [name, location]. The first car to reach a person's location picks them up. Return two rows of passenger names, one for car 0 and one for car 1, in the same order as starts.

If both cars arrive at the same time, the person goes to car 0. Within each car, order passengers by pickup time, breaking equal pickup times by their original row order in people. Cars have unlimited capacity and pickups take no time. Several people may share a location. Empty passenger lists produce empty result rows.

Every road belongs to an acyclic route ending at Campground, every passenger location lies on at least one car route, and all names and locations are valid case-sensitive strings.

Function

assignCarpool(roads: String[][], starts: String[], people: String[][]) → String[][]

Examples

Example 1

roads = [["Bridgewater","Caledonia","30"],["Caledonia","New Grafton","15"],["New Grafton","Campground","5"],["Milton","New Grafton","30"],["Liverpool","Milton","10"]]starts = ["Bridgewater","Liverpool"]people = [["Jessie","Bridgewater"],["Travis","Caledonia"],["Jeremy","New Grafton"],["Katie","Liverpool"]]return = [["Jessie","Travis"],["Katie","Jeremy"]]

Jessie and Travis are on the route of the first car. The second car starts at Liverpool and reaches New Grafton after forty minutes, while the first car needs forty-five, so the second car also picks up Jeremy and Katie. That puts Jessie and Travis in car 0 and Katie and Jeremy in car 1.

Example 2

roads = [["A","M","5"],["B","M","5"],["M","Campground","2"]]starts = ["A","B"]people = [["Mia","M"],["Bob","B"],["Amy","A"]]return = [["Amy","Mia"],["Bob"]]

Both cars reach M after the same time, and ties go to car 0, so it takes Mia. Amy waits at A, where that car starts, so she is picked up at time zero, before Mia. Bob is at B, where the other car starts.

Constraints

  • 0 <= roads.length <= 100, exactly two starts, and 0 <= people.length <= 100.
  • Each origin has one outgoing road; Campground has none. Starts are road endpoints or Campground.
  • Durations are decimal strings representing integers from 1 through 100000.
  • Person names are unique. Names and locations are nonempty printable ASCII strings of at most 30 characters.

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

  • Mutual-Friend Referral RecommendationsFireworks AI · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Top K Users by Distinct ContactsGoogle · PHONE SCREENGoogle interview questions
  • Resource Transition ProbabilitiesWhatNot · PHONE SCREENWhatNot interview questions
  • Resource Transition GraphIndeed · PHONE SCREENIndeed interview questions
  • Find Every Reachable Derived Vocabulary WordDuolingo · PHONE SCREENDuolingo interview questions
  • Order Employees by a Reports-To HierarchyBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Rooms With Two Other Entrances and a Treasure SuccessorWalmart · PHONE SCREENWalmart interview questions
  • Parent and Child Counts for Every NodeKarat · PHONE SCREENKarat interview questions
  • Nodes With Zero or Three ParentsCompass International Holdings · PHONE SCREENCompass International Holdings interview questions

Atlassian interview experiences

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