FastPrepDocument Indexer Scheduling Metrics
Problems/Document Indexer Scheduling Metrics

Document Indexer Scheduling Metrics

Glean logoGlean● HardFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the assignment policy and one worked result. It does not state how ranking ties work, what happens with empty workloads, the constraints, or the exact shape of the return value. Our version is about 94% the same as the reported question.

You manage indexerCount document indexers numbered from 0 through indexerCount - 1. Document i arrives at time queueTimes[i] and occupies one indexer for processingTimes[i] time units.

Document i prefers indexer i % indexerCount. Starting there, scan indexers in increasing numeric order and wrap from the last indexer to indexer 0. Assign the document to the first indexer whose previous job finishes at or before its arrival time. If every indexer is busy, drop the document.

After all arrivals, rank every indexer by documents processed in descending order, breaking ties by smaller indexer number. Let topCount = min(k, indexerCount).

Return an integer array with these values, in this order:

  1. the total number of successfully processed documents;
  2. the busiest indexer, using the ranking rule above;
  3. the number of successful documents processed by the first topCount ranked indexers;
  4. the total number of successfully processed documents again, as the denominator of the exact top-indexer share; and
  5. the topCount ranked indexer numbers.

The third and fourth values represent the exact share. For example, 3 and 4 mean 3/4 = 75%. When no document is processed, both share values are 0; indexer 0 is busiest by the tie rule.

Function

summarizeIndexerLoad(indexerCount: int, queueTimes: int[], processingTimes: int[], k: int) → int[]

Examples

Example 1

indexerCount = 3queueTimes = [1,2,3,7]processingTimes = [5,4,3,2]k = 2return = [4,0,3,4,0,1]

The four documents go to indexers 0, 1, 2, 0. Counts are [2,1,1], so indexer 0 is busiest and the top two are [0,1]. They processed 3/4 = 75% of all successful documents.

Example 2

indexerCount = 2queueTimes = [1,2,3,6]processingTimes = [5,5,1,1]k = 5return = [3,0,3,3,0,1]

The third document is dropped because both indexers are busy. At time 6, indexer 0 is free, so the last document wraps from preferred indexer 1 to indexer 0. Because k exceeds the indexer count, both indexers are returned.

Example 3

indexerCount = 3queueTimes = [1,2,3,4]processingTimes = [10,10,1,1]k = 2return = [4,2,3,4,2,0]

The fourth document prefers indexer 0, finds indexers 0 and 1 busy, and reaches indexer 2 after wrapping. Counts are [1,1,2], so the top two are [2,0] and their share is 3/4.

Constraints

  • 1 <= indexerCount <= 10^5.
  • 0 <= queueTimes.length = processingTimes.length <= 2 * 10^5.
  • 0 <= k <= 2 * 10^5.
  • 0 <= queueTimes[i] <= 10^9.
  • queueTimes is strictly increasing.
  • 1 <= processingTimes[i] <= 10^9.

More Glean Phone Screen questions

  • Validate a Chess Bishop, Rook, or Queen MovePHONE SCREEN · Seen Nov 2026
  • Apply a 2048 Board MovePHONE SCREEN · Seen Oct 2026
  • Group Transitive Synonyms by Four-Token ContextPHONE SCREEN · Seen Aug 2026
  • Sort One Displaced ElementPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Document Enrichment Stream AggregatorBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Alert Engine with a Repeat IntervalChronosphere · PHONE SCREEN
  • Finish Time of Fixed-Length CPU TasksGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Shortest-Job-First Process SchedulingByteDance · PHONE SCREENByteDance interview questions
  • Allocate Orders with FIFO and Pro RataAkuna Capital · PHONE SCREENAkuna Capital interview questions
  • Progressive Banking SystemAirbnb · OAAirbnb interview questions
  • Cloud Compute Credits SystemCoinbase · OACoinbase interview questions
  • Initial Public OfferingPoint72 · OAPoint72 interview questions
  • Inventory AllocationAmazon · OA
  • Cursor-Based Pagination Over Sorted LogsRoblox · ONSITE INTERVIEWRoblox interview questions
All Glean interview questionsSee Glean hiring insights
Saved
class Solution {
    public int[] summarizeIndexerLoad(int indexerCount, int[] queueTimes, int[] processingTimes, int k) {
        // Write your code here.
    }
}
Checking account…