Problems > Round Trip of the Salesman > Editorial

Round Trip of the Salesman — Solution & Editorial

Back to the Problem

Held–Karp bitmask DP: dp[mask][u] = cheapest path visiting exactly 'mask' cities ending at u. Transition to unvisited v; close the tour back to city 1 at the end.

Complexity: O(2N · N2)