BackmediumUncategorized uncategorized medium

Minimum Subsets with Bounded Sum Solution

Problem Statement

Given an array of integers `nums` and an integer `limit`, partition the array into the minimum number of groups such that the sum of elements in each group does not exceed `limit`. Each element from the array must belong to exactly one group.

Example 1
Input
weights = [4, 8, 2, 6], capacity = 10
Output
undefined

Explanation: We can partition the weights into two optimal groups: [4, 6] (sum 10) and [8, 2] (sum 10).

Constraints

  • 1 <= nums.length <= 16
  • 1 <= nums[i] <= limit <= 10^9
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free