As reported: Atlassian P40 (2025), data structures round:
Nservices and edges[a, b, latency]meaning serviceacalls servicebwith that latency; answerQqueries for the minimum latency from serviceXto serviceY. The discussion covered why DFS / BFS is wrong here, Dijkstra, alternatives and complexity.
There are n services 0 … n−1. edges[i] = [a, b, latency] means service a calls service b, which takes latency (a call is one-way). For each query [x, y], return the minimum total latency of a chain of calls from x to y, 0 if x == y, or -1 if y cannot be reached from x.
Example 1
n = 4, edges = [[0,1,5],[1,2,3],[0,2,10],[2,3,1]]
queries = [[0,2],[0,3],[3,0],[1,1]]
Output: [8,9,-1,0]
0 → 1 → 2 costs 8, cheaper than the direct call (10).
Example 2
n = 3, edges = [[0,1,100],[0,2,1],[2,1,1]], queries = [[0,1],[1,0],[2,1]]
Output: [2,-1,1]
Constraints: 1 ≤ n ≤ 1000; 0 ≤ edges.length ≤ 2·10^4; 1 ≤ latency ≤ 10^6; 1 ≤ queries.length ≤ 1000. There may be several edges between the same pair of services.
Code runner format: one JSON value per line: n, edges, queries. Implement minLatency(n, edges, queries); the harness prints the answers.