Tap here to switch tabs
Problem
Submissions

Problem: Partition to K Equal Sum Subsets

med
30 min
Try to solve the Partition to K Equal Sum Subsets problem.

Statement

Given an integer array nums and an integer k, return true if it is possible to partition nums into k non empty subsets such that the sum of elements in every subset is equal, or false otherwise.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤16\leq 16

  • 1≤1 \leq nums[i] ≤104\leq 10^4

  • The frequency of each element is in the range [1,4][1, 4].

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Partition to K Equal Sum Subsets

med
30 min
Try to solve the Partition to K Equal Sum Subsets problem.

Statement

Given an integer array nums and an integer k, return true if it is possible to partition nums into k non empty subsets such that the sum of elements in every subset is equal, or false otherwise.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤16\leq 16

  • 1≤1 \leq nums[i] ≤104\leq 10^4

  • The frequency of each element is in the range [1,4][1, 4].