LeetCode 352: Data Stream as Disjoint Intervals
Problem Restatement We need to design a data structure called SummaryRanges . It receives non-negative integers from a data stream, one number at a time. After each insertion, it should be able to return all numbers seen so far as a sorted list of disjoint intervals. For example, if the stream gives: 1, 3, 7, 2, 6 Then the intervals change like this: after 1: [[1, 1]] after 3: [[1,...