Search
⌘K
Get Premium
Leetcode 1969. Minimum Non-Zero Product of the Array Elements
Given p, you may swap corresponding bits between any pair of numbers in the set {1,...,2^p-1}; compute the minimum possible non-zero product of the array modulo 1e9+7. Core insight: bit rearrangement lets you form one value 2^p-2 and (2^{p-1}-1) pairs whose products equal 2^p-1, so the minimum product is (2^p-2) * (2^p-1)^(2^{p-1}-1), computed with modular exponentiation (p ≤ 60).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.