Skip to content

Practice Partition Array into Two Equal Product Subsets

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

Medium#3566
LeetCode Problem

Partition Array into Two Equal Product Subsets

Problem Statement

You are given an integer array nums containing distinct positive integers and an integer target. Determine if you can partition nums into two non-empty disjoint subsets, with each element belonging to exactly one subset, such that the product of the elements in each subset is equal to target. Return true if such a partition exists and false otherwise.

Source: Partition Array into Two Equal Product Subsets on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [3,1,6,8,4], target = 24
Output
true

# Example 2

Input
nums = [2,5,3,7], target = 15
Output
false

Constraints

3 <= nums.length <= 12
1 <= target <= 10^15
1 <= nums[i] <= 100
All elements of nums are distinct.

Related LeetCode Problems

Practice more problems similar to Partition Array into Two Equal Product Subsets.

Review your practice with PhantomCodeAI

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