Find the Shortest Superstring
HardLeetCodeAdvanced DP (Bitmask, Digit, Interval)
Approach hintTry it first, then revealHide
Precompute the overlap of every ordered pair of words; the task becomes a shortest Hamiltonian path. Run dp[mask][last] over subsets and keep parent pointers to rebuild the string, in O(2^n * n^2).