Solved programs: Examples: We can solve this problem recursively, we keep an array for sum of each partition and a boolean array to check whether an element is already taken into some partition or not. » C

Given an array of integers nums and a positive integer k, find whether it’s possible to divide this array into k non-empty subsets whose sums are all equal. » Articles ❤ We can feature your method in one of the blog posts. Example 1:Input: nums = [4, 3, 2, 3, 5, 2, 1], k = 4Output: TrueExplanation: It’s possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) with equal sums. I was reading up on the set partition problem on this site of Wikipedia: ... they present a DP approach to solving the equal subset sum problem for 2 subsets by finding a subset that sums to half the total sum of the set. Please write to us at contribute@geeksforgeeks.org to report any issue with the above content. In below code a recursive method is written which tries to add array element into some subset. Input : arr, Output : Yes » Node.js » DBMS Are you a blogger? See your article appearing on the GeeksforGeeks main page and help other Geeks.