Search
⌘K

Leetcode 2572. Count the Number of Square-Free Subsets

Count the number of non-empty subsets whose product is square-free (no prime squared divides it) modulo 1e9+7. With nums[i] ≤ 30 and n ≤ 1000, the core challenge is avoiding repeated prime factors across subset elements—typically solved by counting frequencies and using DP over prime-factor bitmasks (treating 1s separately).


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.