#3145
Find Products of Elements of Big Array
international master · 2120 · lc hard +32 · 24.6% accepted · 62 likes · top 4%
Description
The powerful array of a non-negative integer x is the sorted list of distinct powers of two that sum to x (its set-bit decomposition). The infinite array big_nums is formed by concatenating the powerful arrays of 1, 2, 3, … in order. For each query [fromi, toi, modi], compute the product big_nums[fromi] * ... * big_nums[toi] modulo modi. Return all query results.
Code
1
2
3