1735. Count Ways to Make Array With Product Hard
1/**
2 * [1735] Count Ways to Make Array With Product
3 *
4 * You are given a 2D integer array, queries. For each queries[i], where queries[i] = [ni, ki], find the number of different ways you can place positive integers into an array of size ni such that the product of the integers is ki. As the number of ways may be too large, the answer to the i^th query is the number of ways modulo 10^9 + 7.
5 * Return an integer array answer where answer.length == queries.length, and answer[i] is the answer to the i^th query.
6 *
7 * Example 1:
8 *
9 * Input: queries = [[2,6],[5,1],[73,660]]
10 * Output: [4,1,50734910]
11 * Explanation: Each query is independent.
12 * [2,6]: There are 4 ways to fill an array of size 2 that multiply to 6: [1,6], [2,3], [3,2], [6,1].
13 * [5,1]: There is 1 way to fill an array of size 5 that multiply to 1: [1,1,1,1,1].
14 * [73,660]: There are 1050734917 ways to fill an array of size 73 that multiply to 660. 1050734917 modulo 10^9 + 7 = 50734910.
15 *
16 * Example 2:
17 *
18 * Input: queries = [[1,1],[2,2],[3,3],[4,4],[5,5]]
19 * Output: [1,2,3,10,5]
20 *
21 *
22 * Constraints:
23 *
24 * 1 <= queries.length <= 10^4
25 * 1 <= ni, ki <= 10^4
26 *
27 */
28pub struct Solution {}
29
30// problem: https://leetcode.com/problems/count-ways-to-make-array-with-product/
31// discuss: https://leetcode.com/problems/count-ways-to-make-array-with-product/discuss/?currentPage=1&orderBy=most_votes&query=
32
33// submission codes start here
34
35impl Solution {
36 pub fn ways_to_fill_array(queries: Vec<Vec<i32>>) -> Vec<i32> {
37 vec![]
38 }
39}
40
41// submission codes end
42
43#[cfg(test)]
44mod tests {
45 use super::*;
46
47 #[test]
48 fn test_1735() {
49 }
50}
51
Back
© 2025 bowen.ge All Rights Reserved.