FastPrepTrack Received Byte Ranges
Problems/Track Received Byte Ranges

Track Received Byte Ranges

Roblox logoRoblox● MediumNEW GRADOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source provides the streaming file-upload setting, the interval-merging objective, a result after every chunk, left-endpoint sorting, and the exact adjacency rule. The endpoint convention, callable interface, output serialization, malformed-input behavior, and numeric bounds are bounded practice assumptions; the judged core task matches the visible source at about 82%.

A file is uploaded as a sequence of byte-range chunks. Each chunks[i] is an inclusive, 1-based range [start, end].

After each chunk arrives, consolidate every byte received so far into disjoint consecutive ranges. Overlapping or adjacent ranges merge. For example, [1, 3] and [4, 6] merge because 4 <= 3 + 1.

Return one snapshot after each arrival. Within each snapshot, sort ranges by their left endpoint and serialize each range as start:end.

Function

trackReceivedByteRanges(chunks: long[][]) → String[][]

Examples

Example 1

chunks = [[1,3],[4,6]]return = [["1:3"],["1:6"]]

After the first arrival the received range is 1:3. The second chunk is adjacent, so the ranges merge into 1:6.

Example 2

chunks = [[8,10],[1,2],[2,8],[4,5]]return = [["8:10"],["1:2","8:10"],["1:10"],["1:10"]]

The third chunk connects and overlaps both existing ranges, producing 1:10. The final contained chunk leaves that range unchanged.

Constraints

  • 1 <= chunks.length <= 2000.
  • Every chunks[i] contains exactly two signed 64-bit integers.
  • 1 <= chunks[i][0] <= chunks[i][1] <= 10^18.
  • Duplicate and fully contained chunks are valid and do not change the consolidated ranges.

More Roblox problems

  • Design Search Autocomplete SystemPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Most Frequent Call Path From Function Trace LogsPHONE SCREEN · Seen Nov 2026
  • Candy Crush Grid Matching and GravityPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public String[][] trackReceivedByteRanges(long[][] chunks) {
        // Write your code here.
    }
}
Checking account…