FastPrepPriority Graph: First Arrival Times
Problems/Priority Graph: First Arrival Times

Priority Graph: First Arrival Times

Intuit logoIntuit● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit new grad online assessment. The report gives the rule for choosing by priority, ties going to the shortest edge, tracing back through the first parent, and the first-arrival output. We chose a last tie rule by node ID, that the graph is connected, and a fixed function input. Our version is about 90% the same as the reported question.

Start at node 0 in a connected undirected weighted graph with nodes 0..n-1. At your current node, choose an unvisited adjacent node with greatest priority. Break equal-priority ties by the smaller incident edge distance, then by smaller node ID. Travel that edge and record the destination first-arrival time.

If no unvisited neighbor exists, travel back along the edge by which you first entered the current node. Start time is zero and each edge takes its distance in time units. Stop as soon as every node has been visited. Return first-arrival times for nodes 1..n-1 in node-ID order. priorities[0] is ignored; edges contain [u,v,distance].

Function

arrivalTimes(priorities: int[], edges: int[][]) → long[]

Examples

Example 1

priorities = [0,5,10,1]edges = [[0,1,2],[0,2,3],[1,3,4]]return = [8,3,12]

Visit node 2 at time 3, return to 0 at 6, visit 1 at 8 and 3 at 12.

Example 2

priorities = [0,5,5]edges = [[0,1,7],[0,2,2]]return = [11,2]

Equal priorities prefer the shorter edge, so node 2 is first.

Constraints

  • For this exercise, assume 1 <= n <= 2000, at most 5000 edges, no self-loops or parallel edges, connectedness, signed 32-bit priorities, and distances in [0,10^6].
  • Return signed 64-bit times.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Module Rebuild CostsAirbnb · OAAirbnb interview questions
  • Evolving Merchant Clusters and Persistent PinsStripe · OAStripe interview questions
  • Create Lexicographically Largest PermutationOracle · OAOracle interview questions
  • Top-Rated Similar MoviesGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Aggregate Machine TopologyOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Deterministic Depth-First Graph TraversalWaymo · PHONE SCREENWaymo interview questions
  • Traverse an Up-Down-Right Pointer StructureBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Reconstruct ItineraryTripjack · ONSITE INTERVIEWTripjack interview questions
  • Delivery Management SystemAkuna Capital · OAAkuna Capital interview questions
  • Part 1: The Narrowest KeyScale AI · OAScale AI interview questions

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public long[] arrivalTimes(int[] priorities, int[][] edges) {
        // Write your code here
    }
}
Checking account…