FastPrepBusiest Distribution Center
Problems/Busiest Distribution Center

Busiest Distribution Center

Capital One logoCapital One● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A 2023 Capital One report from an associate software engineer candidate covers the initial assessment, a test of four questions. One of those questions simulated packages moving through distribution centers. For it, the report covers how the winning center and ties are decided, what a closure does, a capacity range of 1 to 5 per center, and the fill order with a refill once every center has had its turn.

It does not give the exact log text, how a closure names its center, whether a closed center can reopen, what happens to packages a closed center already took, or limits on the number of centers and log entries. Here a closure is written as CLOSED followed by the center number and holds from that entry onward, with no reopening. Each center is closed at most once and some center always stays open. A closed center keeps the packages it already took, and a closure does not end the round. The capacity range is as reported. The limits on centers and log length are our choice.

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

Simulate one day of package routing across distribution centers 0, 1, ..., n - 1. In each round, center j can take up to centerCapacity[j] packages. Keep two pieces of state: a current center cur, which starts at 0, and room[j], which starts at centerCapacity[j] for every center.

Each entry of dailyLogs, taken from first to last, does one of two things:

  • "CLOSED j": center j is out of service from this entry onward. Nothing else changes: cur stays where it is, and no room is given back.
  • "PACKAGE": while center cur is out of service or room[cur] is 0, advance cur. Advancing from n - 1 sets cur to 0 and resets every room[j] to centerCapacity[j], which starts a new round. Then center cur takes the package, and room[cur] drops by 1.

Let total[j] be the number of packages center j took over the whole log, including packages taken before it went out of service. Among the centers whose total equals the maximum total, return the largest center number.

Function

busiestCenter(centerCapacity: int[], dailyLogs: String[]) → int

Examples

Example 1

centerCapacity = [2,4,1,5]dailyLogs = ["CLOSED 3","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE"]return = 1
  • CLOSED 3 comes before any package, so center 3 never takes one.
  • Round 1: center 0 takes packages 1 and 2, center 1 takes packages 3 to 6, and center 2 takes package 7. The pointer then passes center 2 and the closed center 3 and wraps around, which starts round 2 with all capacities back.
  • Center 0 takes packages 8 and 9. Final counts: [4, 4, 1, 0]. Centers 0 and 1 both reach 4, and 1 is the larger of the two.

Example 2

centerCapacity = [1,2,4,2,1]dailyLogs = ["PACKAGE","PACKAGE","CLOSED 2","PACKAGE","PACKAGE","PACKAGE","PACKAGE","CLOSED 1","PACKAGE","PACKAGE"]return = 3
  • Package 1 fills center 0, and package 2 goes to center 1.
  • CLOSED 2 takes center 2 out of service before it gets anything. The round keeps going: package 3 fills center 1, center 2 is passed over, packages 4 and 5 fill center 3, and package 6 fills center 4.
  • CLOSED 1 then takes center 1 out of service. Its 2 packages stay in its total.
  • Package 7 starts round 2 at center 0. Every center gets its room back, but centers 1 and 2 stay out of service, so package 8 goes to center 3.
  • Final counts: [2, 2, 0, 3, 1], so the answer is 3.

Example 3

centerCapacity = [1,4,2,2]dailyLogs = ["PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","PACKAGE","CLOSED 1"]return = 1
  • Round 1 uses all 9 slots: centers 0 to 3 take 1, 4, 2 and 2 packages.
  • Round 2: center 0 takes package 10 and center 1 takes package 11.
  • The last entry, CLOSED 1, comes after every package, and center 1 keeps all 5 of its packages.
  • Final counts: [2, 5, 2, 2], so the answer is 1, a center that is closed at the end.

Constraints

  • 1 <= centerCapacity.length <= 1000
  • 1 <= centerCapacity[j] <= 5
  • 1 <= dailyLogs.length <= 10^4
  • Allowed entries: "PACKAGE", and "CLOSED j" with 0 <= j < centerCapacity.length written in decimal without leading zeros.
  • A center number appears in at most one "CLOSED" entry, and the "CLOSED" entries name fewer than centerCapacity.length centers.

More Capital One Online Assessment questions

  • Branch with the Most FilesOA · Seen Nov 2026
  • Earliest Meeting Time for All EmployeesOA · Seen Nov 2026
  • Earn the Most 🐝OA · Seen Nov 2026
  • Rank Football TeamsOA · Seen Oct 2026
  • Count Subarrays Matching a Comparison PatternOA · Seen Oct 2026
  • Arithmetic Triplets After QueriesOA · Seen Oct 2026
  • Count One-Swap Number PairsOA · Seen Oct 2026
  • Distinct Values on Maximum-Sum FramesOA · Seen Oct 2026
  • Sort Adjacent PairsOA · Seen Oct 2026
  • Bouncing Diagonal WeightsOA · Seen Oct 2026

Similar questions at other companies

  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Repeated Mirror XORMathWorks · OAMathWorks interview questions
  • Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
  • Stabilize Student Test ScoresVirtu Financial · OAVirtu Financial interview questions
  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions
  • Index of the Maximum After Left RotationsChubb · OAChubb interview questions
  • Leaves Remaining After WindCresta · OACresta interview questions
  • Rolling MetricsAkuna Capital · OAAkuna Capital interview questions

Capital One interview experiences

  • Capital One Coding OA Questions: 3 Experiences
  • Capital One Experienced Engineer Power Day and OA: 6 Experiences
  • Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
  • Capital One TDP Agentic Round (AI Coding): 7 Experiences
  • Capital One SWE Power Day, Level Not Reported: 6 Experiences
  • Capital One TIP Intern OA and Power Day: 13 Experiences
All Capital One interview questionsSee Capital One hiring insights
Saved
class Solution {
    public int busiestCenter(int[] centerCapacity, String[] dailyLogs) {
        // Write your code here.
    }
}
Checking account…