FastPrepMinimum Price With Discount Coupons
Problems/Minimum Price With Discount Coupons

Minimum Price With Discount Coupons

Agoda logoAgoda● MediumCONTRACTOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

A store offers n items, where price[i] is the original price of the i-th item. A customer has m discount coupons.

If x coupons are applied to the i-th item, its price is reduced to floor(price[i] / 2^x).

Return the minimum total cost to purchase all items by optimally allocating at most m coupons.

Function

findMinimumPrice(price: int[], m: int) → int

Examples

Example 1

price = [2,4]m = 2return = 3

Buy the first item for 2. Apply both coupons to the second item, reducing its price to floor(4 / 2^2) = 1. The minimum total cost is 2 + 1 = 3.

Constraints

  • 1 <= price.length
  • 0 <= m
  • price[i] >= 0

More Agoda Online Assessment questions

  • Special Diameter EndpointsOA · Seen Nov 2025
  • TV Series in a Production WindowOA · Seen Nov 2025
  • Count One Groups by SizeOA · Seen Jul 2025
  • Lexicographically Smallest Task QueueOA · Seen Jul 2025
  • Highest-Ranked University by CountryOA · Seen Jun 2025
  • Jump Game with Prime-3 StepsOA · Seen Jun 2025
  • Team FormationOA · Seen Apr 2025
  • Two-Core Process AssignmentOA · Seen Apr 2025
  • Unique Digits in RangeOA · Seen Apr 2025
  • Maximize Sum of Processed TimesOA · Seen Sep 2024

Similar questions at other companies

  • Minimum Cost to Merge Values into OnePayPal · OAPayPal interview questions
  • Task SchedulerAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Maximum Sum of a K-StarMicrosoft · OAMicrosoft interview questions
  • Maximum ScoreNVIDIA · OANVIDIA interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Maximum K-Star SumC3.ai · OAC3.ai interview questions
  • Task SchedulingJP Morgan Chase · OAJP Morgan Chase interview questions
  • Decreasing SubsequencesGoogle · OAGoogle interview questions
  • Get Maximum AmountIBM · OAIBM interview questions
  • Optimize TikTok Reels ViewingTikTok · OATikTok interview questions

Agoda interview experiences

  • Agoda Staff Backend OA Questions: 5 Experiences
All Agoda interview questionsSee Agoda hiring insights
Saved
class Solution {
    public int findMinimumPrice(int[] price, int m) {
      // write your code here
    }
}
Checking account…