1969. Minimum Non-Zero Product of the Array Elements

Обновлено: 2024-03-12
1 мин
[]

Содержание

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