FastPrepSpend a Budget Across Five Price Tiers
Problems/Spend a Budget Across Five Price Tiers

Spend a Budget Across Five Price Tiers

Expedia logoExpedia● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A post published on October 26, 2021, about interviews for Expedia's 2022 summer SDE internship puts this task in the first round. It fixes five prices and, for a given budget, wants a count of places at each price that wastes as little of the budget as possible.

The post gives no limits or examples. It does not say how many places are available at each price, or which split to return when several leave the same amount. Here, each price has as many places as needed. The counts come back as an array in the same order as the post's price list (100 down to 5). A tie goes to the split with the most places at 100, then at 50, and so on down. The budget is from 0 to 10^6.

Our version is about 85% the same as the reported question.

A travel app groups the places you can visit into five price tiers: 100, 50, 25, 10 and 5. Every place in a tier costs that tier's price, and each tier has as many places as you want.

Given budget, choose how many places of each tier to visit so that the total price is at most budget and the money left over is as small as possible.

Several plans can leave the same amount. Among them, pick the plan with the most places at price 100. If that still ties, pick the one with the most places at 50, then at 25, then at 10.

Return an array of five counts: the number of places at 100, 50, 25, 10 and 5, in that order.

Function

placesPerTier(budget: int) → int[]

Examples

Example 1

budget = 1234return = [12,0,1,0,1]

12 places at 100 cost 1200 and leave 34. 50 does not fit, one place at 25 leaves 9, 10 does not fit, and one place at 5 leaves 4. Every price is a multiple of 5, so no plan can leave less than 4.

Example 2

budget = 33return = [0,0,1,0,1]

The smallest possible leftover is 3. Both 25 + 5 and 10 + 10 + 10 leave 3. The tie goes to the plan with more places at the higher price, so the answer is one place at 25 and one at 5.

Example 3

budget = 1985return = [19,1,1,1,0]

19 places at 100 leave 85, then one at 50 leaves 35, one at 25 leaves 10, and one at 10 leaves 0. Nothing is left over.

Constraints

  • 0 <= budget <= 10^6

More Expedia Onsite Interview questions

  • Scramble StringONSITE INTERVIEW · Seen Sep 2026
  • Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
  • Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
  • Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
  • Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
  • Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
  • Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
  • Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
  • Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Maximum 69 NumberHSBC · ONSITE INTERVIEWHSBC interview questions
  • Maximize the Chance of Selecting the Best CandidateGoogle · ONSITE INTERVIEWGoogle interview questions
  • Fewest Bills and CoinsCapital One · ONSITE INTERVIEWCapital One interview questions
  • Integer BreakAmazon · ONSITE INTERVIEW
  • Maximum Bananas Delivered by a CamelStackAdapt · ONSITE INTERVIEWStackAdapt interview questions
  • UCB1 Multi-Armed Bandit TraceWayfair · ONSITE INTERVIEWWayfair interview questions
  • Reach a Target by Adding CoordinatesJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
  • Server InvestmentRippling · OARippling interview questions
  • Maximum Three-Server Difficulty ScoreVisa · OAVisa interview questions
  • Particle Moves to TargetCresta · OACresta interview questions

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)
  • Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
class Solution {
    public int[] placesPerTier(int budget) {
        // Write your code here.
    }
}
Checking account…