Max Profit

Problem Overview

  • Determine the maximum profit achievable with a given budget.
  • Input: int[] cost and money x; Output: max profit reported as maxProfit % (10^9+7); constraints: n≤1e5, cost[i]≤1e5, x≤1e9.
  • Models a budgeted purchasing scenario where profit is optimized under cost limits.
  • From Ibm interviews; a common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: