FastPrepRunning Union Length after Interval Uploads
Problems/Running Union Length after Interval Uploads

Running Union Length after Interval Uploads

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes uploading line intervals, overlap, and returning the length of the occupied union after each upload. We supplied continuous half-open endpoints, the row shape, valid ordering, and limits. Our version is about 86% the same as the reported question.

Each row [left, right] uploads a continuous half-open interval [left, right) with left < right. Intervals may overlap or touch.

After every upload, return the total length covered by the union of all intervals seen so far.

Function

runningUnionLengths(uploads: long[][]) → long[]

Examples

Example 1

uploads = [[1,5],[3,8]]return = [4,7]

The second interval adds only its uncovered suffix.

Example 2

uploads = [[1,2],[5,9]]return = [1,5]

Disjoint lengths add.

Constraints

  • 1 <= uploads.length <= 2000
  • -10^12 <= left < right <= 10^12

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Earliest Meeting Time for All EmployeesCapital One · OACapital One interview questions
  • Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
  • Largest Team Where Every Pair OverlapsWalmart · OAWalmart interview questions
  • Minimum Cars for Rental RequestsGoogle · OA · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Maximum Compatible Time WindowsIBM · OAIBM interview questions
  • Merge Overlapping IntervalsGoldman Sachs · OAGoldman Sachs interview questions
  • Maximum Concurrent ProcessesMorgan Stanley · OA · ONSITE INTERVIEWMorgan Stanley interview questions
  • Track Received Byte RangesRoblox · OARoblox interview questions
  • Merge IntervalsBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public long[] runningUnionLengths(long[][] uploads) {
        // Write your code here.
    }

}
Checking account…