Search
⌘K

Leetcode 3149. Find the Minimum Cost Array Permutation

Find a Hamiltonian cycle on nodes 0..n-1 where the directed edge cost from u to v is |u - nums[v]|, and return the permutation (cycle order) with minimum total cost, breaking ties by lexicographic order. With n ≤ 14 this is typically solved by exponential (bitmask/DP or search) techniques.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.