FastPrepMinimum Labels after Removing Boxes
Problems/Minimum Labels after Removing Boxes

Minimum Labels after Removing Boxes

Expedia logoExpedia● MediumNEW GRADINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report's example [3,4,5,3] with M=2 and its goal of removing exactly M are kept. We chose the limits and what happens with empty input. Our version is about 97% the same as the reported question.

Each entry of labels is the label on one box. Remove exactly removals boxes to minimize the number of distinct labels among the boxes left.

Return that minimum count. Boxes with the same label are interchangeable. Removing all boxes leaves zero labels.

Function

minimumLabels(labels: int[], removals: int) → int

Examples

Example 1

labels = [3,4,5,3]removals = 2return = 1

Remove the singleton labels 4 and 5. The two boxes labeled 3 remain.

Example 2

labels = [1,1,2]removals = 1return = 1

Remove the one box labeled 2.

Constraints

  • 0 <= labels.length <= 10000.
  • 1 <= labels[i] <= 1000000000.
  • 0 <= removals <= 10000.
  • removals does not exceed labels.length.

More Expedia Online Assessment questions

  • Balanced NumbersOA · Seen Aug 2026
  • REST API: Discounted PriceOA · Seen Aug 2026
  • Maximum Team SizeOA · Seen Mar 2026
  • Per-Domain Request LimiterOA · Seen Oct 2025
  • Count Equal-Frequency SubsequencesOA · Seen Mar 2025
  • Count Increasing Stock PeriodsOA · Seen Mar 2025
  • Get Minimum StepsOA · Seen Oct 2024
  • Rank Songs by PopularityOA · Seen Oct 2024
  • Calculate the SumOA · Seen Oct 2024
  • Get Maximum EfficiencyOA · Seen Oct 2024

Similar questions at other companies

  • Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
  • Minimum Distinct Prefix CostChubb · OAChubb interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
  • 🐘 Keep Them Apart 🦙QRT · OA
  • Minimum Operations to Make Array ValidAmazon · OA
  • Maximum MEXAtlassian · OAAtlassian interview questions
  • Minimize Distinct Item Types After RemovalsRoblox · OARoblox interview questions
  • Maximum Distinct Values After SwapsAkuna Capital · OAAkuna Capital interview questions
  • Min Cost to Complete All ProjectsSalesforce · OASalesforce interview questions

Interview reports that mention this question

  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia New Grad SDE Earlier Loops: 5 Experiences (Part 2 of 3)

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 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
class Solution {
    public int minimumLabels(int[] labels, int removals) {
        // Write your code here.
    }

}
Checking account…