Tap here to switch tabs
Problem
Submissions

Problem: Maximum Capacity Within Budget

Try to solve the Maximum Capacity Within Budget problem.

Statement

You are given two integer arrays costs and capacity, both of length n, and an integer budget.

You may choose at most 22 distinct machines such that the sum of their costs is strictly less than budget.

Return the maximum total capacity that can be obtained. If no machines can be selected, return 00.

Constraints:

  • 1≤n=1 \leq n = costs.length == capacity.length ≤105\leq 10^5

  • 1≤1 \leq costs[i], capacity[i] ≤105\leq 10^5

  • 1≤1 \leq budget ≤2imes105\leq 2 imes 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Capacity Within Budget

Try to solve the Maximum Capacity Within Budget problem.

Statement

You are given two integer arrays costs and capacity, both of length n, and an integer budget.

You may choose at most 22 distinct machines such that the sum of their costs is strictly less than budget.

Return the maximum total capacity that can be obtained. If no machines can be selected, return 00.

Constraints:

  • 1≤n=1 \leq n = costs.length == capacity.length ≤105\leq 10^5

  • 1≤1 \leq costs[i], capacity[i] ≤105\leq 10^5

  • 1≤1 \leq budget ≤2imes105\leq 2 imes 10^5