FastPrepAggregate Paginated Project Run Records
Problems/Aggregate Paginated Project Run Records

Aggregate Paginated Project Run Records

Replit logoReplit● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Replit online assessment. The public report mentions basic API calls and data work. It does not give the endpoint, the response schema, the change to make, or the output order. We wrote a fixed way to read paginated records. Our version is about 30% the same as the reported question.

A project-runs API has already been queried page by page. The flattened responses are provided in pageRecords, in page order and then response order within each page.

Each row contains exactly five strings:

  1. pageNumber: the positive decimal page number.
  2. runId: the run's unique identifier.
  3. projectId: the project that owns the run.
  4. status: one of SUCCESS, FAILED, or CANCELED.
  5. durationMs: a nonnegative decimal duration in milliseconds.

Rows are ordered by increasing page number. A changing paginated data set can repeat the same runId. Process rows from left to right and treat the first occurrence of each runId as authoritative; ignore every later occurrence completely, even when its fields differ.

After deduplication, keep only rows whose status is exactly SUCCESS. For each projectId, compute its number of successful runs and the sum of their durations. Keep projects with at least minSuccessfulRuns successful runs.

Return one row per kept project in the form [projectId, successfulRunCount, totalDurationMs]. Serialize both numeric values as base-10 strings. Sort rows by total duration descending, then successful-run count descending, then project ID in ascending lexicographic order. Return an empty array when no project qualifies.

Function

aggregateProjectRuns(pageRecords: String[][], minSuccessfulRuns: int) → String[][]

Examples

Example 1

pageRecords = [["1","r1","alpha","SUCCESS","120"],["1","r2","beta","FAILED","80"],["2","r3","alpha","SUCCESS","30"],["2","r2","beta","SUCCESS","999"],["2","r4","beta","SUCCESS","200"]]minSuccessfulRuns = 1return = [["beta","1","200"],["alpha","2","150"]]

The first r2 record is authoritative and has status FAILED, so its later successful duplicate is ignored. Project alpha has two successful runs totaling 150 ms, while beta has one totaling 200 ms. The larger total duration places beta first.

Example 2

pageRecords = [["1","c1","core","SUCCESS","50"],["1","e1","edge","SUCCESS","20"],["2","c2","core","CANCELED","100"],["2","e2","edge","SUCCESS","30"],["3","d1","data","SUCCESS","50"]]minSuccessfulRuns = 2return = [["edge","2","50"]]

Only edge reaches the threshold with two successful runs. The canceled core run does not contribute, so core and data each remain below the threshold.

Example 3

pageRecords = [["1","z1","zeta","SUCCESS","40"],["1","z2","zeta","SUCCESS","10"],["1","a1","alpha","SUCCESS","25"],["1","a2","alpha","SUCCESS","25"],["1","b1","beta","SUCCESS","50"]]minSuccessfulRuns = 1return = [["alpha","2","50"],["zeta","2","50"],["beta","1","50"]]

All three projects total 50 ms. Projects with two successful runs precede beta, which has one. The remaining tie places alpha before zeta lexicographically.

Constraints

  • 0 <= pageRecords.length <= 200000.
  • Every row has exactly five strings in the documented order.
  • pageNumber is a positive decimal integer, and rows are ordered by nondecreasing page number.
  • runId and projectId are non-empty printable ASCII strings of length at most 64.
  • status is exactly SUCCESS, FAILED, or CANCELED.
  • 0 <= durationMs <= 10^9.
  • 1 <= minSuccessfulRuns <= 200000.
  • Every project's total successful duration is at most 2 * 10^14 and requires 64-bit arithmetic.

More Replit Online Assessment questions

  • Compress Editor Actions into Operational Transform OperationsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Credit Card Command ProcessorChime · PHONE SCREEN
  • HTTP Request RedirectionAmazon · OA
  • Cheating CodemakerJane Street · OAJane Street interview questions
  • Parse and Filter Chargeback DisputesStripe · OAStripe interview questions
  • Macaron Order with Set DiscountsShopify · OAShopify interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • Parcel Attribute Store with TTLAirbnb · OAAirbnb interview questions
  • Versioned Recipe SystemThe Trade Desk · OA
  • Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions

Replit interview experiences

  • Replit SWE Intern OA and Interviews: 3 Experiences
  • Replit Experienced Full-Time Interviews: 3 Experiences
  • Replit New Grad SWE OA and Interviews: 4 Experiences
See Replit hiring insights
Saved
class Solution {
    public String[][] aggregateProjectRuns(String[][] pageRecords, int minSuccessfulRuns) {
        // Write your solution here.
    }
}
Checking account…