1969. Minimum Non-Zero Product of the Array Elements

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1969

class Solution:
    def minNonZeroProduct(self, p: int) -> int:
        mod = 10**9 + 7
        return (2**p - 1) * pow(2**p - 2, 2 ** (p - 1) - 1, mod) % mod