less than 1 minute read

Given a list of positive integers nums, return whether you can partition nums into two groups where the sum of the elements in both groups is equal.

Constraints

  • n ≤ 250
  • 1 ≤ nums[i] ≤ 100

https://binarysearch.com/problems/Equal-Partitions

Examples

Example 1

Input

  • nums = [1, 2, 5, 4]

Output

  • answer = True

Explanation

We can have these partitions: [1, 5] and [2, 4].

Solution

Categories:

Updated:

Leave a comment