Shortest Path Visiting All Nodes
HardLeetCodeAdvanced DP (Bitmask, Digit, Interval)
Approach hintTry it first, then revealHide
Run a BFS over states (node, visited mask), starting from every node at once. The first state whose mask contains all nodes gives the answer, after at most 2^n * n states.