Company: Autodesk_30sep
Difficulty: medium
Unique Bytes Received Problem Description A team of astronauts on a spaceship is receiving important data from Earth for their research. The data is being transmitted in segments that contain specific parts of the file. Each segment defines a byte range in the form of a two-dimensional array segments[i] . For each segment segments[i] , the range is given in an array of two 64-bit integers: segments[i][0] is the index of the first byte in the i th segment, and segments[i][1] is the index of the last byte in the i th segment (both indices are inclusive, 1-based). Your task is to calculate the total number of unique bytes received for the entire file after each segment is received. Keep in mind that segments can overlap with or completely replicate previous ones. Examples Example 1: Input: segments = [[1, 1], [2, 2], [3, 3]] Output: [1, 2, 3] Explanation: The first segment only contains the byte 1 , so the total number of unique bytes received becomes 1 after this segment. The second segm