Partition Equal Subset Sum

TopicDifficultyCompanies
Dynamic Programming
MEDIUM
Amazon
Adobe

Given a non-empty array of positive integers arr[]. Write a program to find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.

Example 1

Input: arr[] = [1, 6, 11, 6] 
Output: true
Explanation: The array can be partitioned as [6, 6] and [1, 11].

Example 2

Input: arr[] = [2, 6, 7]
Output: false
Explanation: The array cannot be partitioned into equal sum sets.

Code Editor

Practice and Learn

Best way to learn is through solving real problems. Practice this problem in this code editor.