Partition Equal Subset Sum
Input: nums = [1,5,11,5]
Output: true
Explanation: The array can be partitioned as [1, 5, 5] and [11].Input: nums = [1,2,3,5]
Output: false
Explanation: The array cannot be partitioned into equal sum subsets.Intution - We have to divide the array target in two parts
Let say if the total sum of array is 20->
then we just need to find, If there exists a subset having a sum of target of 10
That is sum/2
Now if the total sum is odd we cannot divide the sum , hence directly falseLinks
Video Link
Approach 1:
Approach 2:
Approach 3:
Similar Problems
Last updated