Leetcode 2338. Count the Number of Ideal Arrays
Count how many length-n arrays with values in [1, maxValue] satisfy arr[i] % arr[i-1] == 0 for all i — equivalently, count multiplicative/divisibility chains in the DAG of integers up to maxValue. The solution reduces to counting paths of different distinct-value lengths (via DP over values/multiples) and combining them with combinatorics (choose placements of repeats) modulo 1e9+7.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.