FastPrepMaximum Profit from Ticket Bundles
Problems/Maximum Profit from Ticket Bundles

Maximum Profit from Ticket Bundles

IDFC Bank logoIDFC Bank● MediumFULLTIMEOA
QuestionFunctionExamplesConstraints

Problem statement

You are given an integer array prices, where prices[i] is the profit from selling a bundle of exactly i + 1 tickets.

You must sell exactly m tickets. You may use any combination of bundle sizes, and each bundle size may be used multiple times.

Return the maximum total profit obtainable by selling exactly m tickets.

Function

maxTicketBundleProfit(prices: int[], m: int) → int

Examples

Example 1

prices = [10,70,30]m = 3return = 80

The best choice is one 1-ticket bundle and one 2-ticket bundle, for total profit 10 + 70 = 80. Selling one 3-ticket bundle gives profit 30.

Constraints

  • 1 <= m <= prices.length
  • prices.length gives the largest available ticket-bundle size.

More IDFC Bank problems

  • Employee Free TimeONSITE INTERVIEW · Seen Aug 2026
  • Minimum Cake CutsOA · Seen Jul 2026
  • Smallest Adjacent ConcatenationOA · Seen Jul 2026
All IDFC Bank interview questionsSee IDFC Bank hiring insights
Saved
class Solution {
    public int maxTicketBundleProfit(int[] prices, int m) {
      // write your code here
    }
}
Checking account…