Skip to content

Practice Minimum Non-Zero Product of the Array Elements

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#1969
LeetCode Problem

Minimum Non-Zero Product of the Array Elements

Problem Statement

Start with all integers from 1 through 2^p - 1. In one operation, choose any two elements and swap their bits at the same bit position. You may repeat this operation any number of times. Find the smallest possible nonzero product of all elements, minimizing the actual product before taking any remainder. Return that minimum product modulo 10^9 + 7.

Source: Minimum Non-Zero Product of the Array Elements on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
p = 1
Output
1

# Example 2

Input
p = 2
Output
6

# Example 3

Input
p = 3
Output
1512

Constraints

1 <= p <= 60

Related LeetCode Problems

Practice more problems similar to Minimum Non-Zero Product of the Array Elements.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.