Skip to content

Practice Find Products of Elements of Big Array

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3145
LeetCode Problem

Find Products of Elements of Big Array

Problem Statement

The powerful array of x is the shortest nondecreasing list of powers of two summing to x. Concatenate these lists for positive integers 1, 2, 3, ... to form big_nums. For each query [from,to,mod], return the product of big_nums[from..to] modulo mod, with inclusive zero-based indices. Return answers in query order.

Source: Find Products of Elements of Big Array on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
queries = [[1,3,7]]
Output
[4]

# Example 2

Input
queries = [[2,5,3],[7,7,4]]
Output
[2,2]

Constraints

1 <= queries.length <= 500
queries[i].length == 3
0 <= queries[i][0] <= queries[i][1] <= 10^15
1 <= queries[i][2] <= 10^5

Related LeetCode Problems

Practice more problems similar to Find Products of Elements of Big Array.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.