Minimum Non-Zero Product of the Array Elements LeetCode solution in Python

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

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0