Search
⌘K

Leetcode 3145. Find Products of Elements of Big Array

Define big_nums by concatenating, for each positive integer in order, the sorted list of powers of two that sum to it (its binary decomposition); big_nums therefore contains only powers of two. For each query [l,r,mod], compute the product of big_nums[l..r] mod mod — the core challenge is handling indices up to 1e15 by counting occurrences of each 2^k in a range and using modular exponentiation without constructing the array.


Question Timeline

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

Comments

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