Code Room
CodingHardcod-g755
Subject Bitmask dpLevel Senior–Staff~45 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A delivery drone must visit every one of n depots exactly once, starting at depot 0 and not needing to return. dist[i][j] is the travel cost between depots i and j (symmetric, non-negative). Return the minimum total travel cost of a route that starts at depot 0 and visits all depots. Constraints: 1 <= n <= 14, 0 <= dist[i][j] <= 10^6, dist[i][i] = 0.

Implement
min_tour_cost(dist: list[list[int]]) → int
Examples
in[[[0,10,15],[10,0,20],[15,20,0]]]out30
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.