BackhardBinary Search

Maximum Weighted Subset Sum Solution

Problem Statement

Given a set of integers and their corresponding weights, find the maximum weighted sum of a subset that does not exceed a certain threshold.

Example 1
Input
[3, 5, 2, 7], [2, 3, 1, 4], 15
Output
9

Constraints

  • 1 <= n <= 500
  • 1 <= integers[i] <= 1000
  • 1 <= weights[i] <= 1000
  • 1 <= threshold <= 10000
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