Search
⌘K

Leetcode 2741. Special Permutations

Count the number of permutations of distinct positive integers where every adjacent pair satisfies that one divides the other, returning the result modulo 10^9+7. With n ≤ 14 this is typically solved by treating divisibility as edges in a graph and using bitmask DP to count Hamiltonian paths.


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.