Search
⌘K

Leetcode 1808. Maximize Number of Nice Divisors

Split the given budget of prime factors into exponents e1+e2+... ≤ primeFactors to maximize the product e1*e2*... (each ei≥1), because the number of nice divisors equals that product. This reduces to an integer-partition maximization solved greedily by using as many 3's as possible (adjusting for a remainder 1 by using two 2's), and returning the product mod 1e9+7.


Question Timeline

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

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