Skip to content

Commit 7feac33

Browse files
authored
Update readme.md
1 parent 53a3bed commit 7feac33

File tree

1 file changed

+17
-15
lines changed
  • src/main/java/g0301_0400/s0352_data_stream_as_disjoint_intervals

1 file changed

+17
-15
lines changed

src/main/java/g0301_0400/s0352_data_stream_as_disjoint_intervals/readme.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,30 @@ Implement the `SummaryRanges` class:
1212

1313
**Example 1:**
1414

15-
**Input** \["SummaryRanges", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals"\] \[\[\], \[1\], \[\], \[3\], \[\], \[7\], \[\], \[2\], \[\], \[6\], \[\]\]
15+
**Input**
16+
17+
["SummaryRanges", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals"]
18+
[[], [1], [], [3], [], [7], [], [2], [], [6], []]
1619

1720
**Output:** \[null, null, \[\[1, 1\]\], null, \[\[1, 1\], \[3, 3\]\], null, \[\[1, 1\], \[3, 3\], \[7, 7\]\], null, \[\[1, 3\], \[7, 7\]\], null, \[\[1, 3\], \[6, 7\]\]\]
1821

1922
**Explanation:**
20-
```
21-
SummaryRanges summaryRanges = new SummaryRanges();
22-
summaryRanges.addNum(1); // arr = [1]
23-
summaryRanges.getIntervals(); // return [[1, 1]]
24-
summaryRanges.addNum(3); // arr = [1, 3]
25-
summaryRanges.getIntervals(); // return [[1, 1], [3, 3]]
26-
summaryRanges.addNum(7); // arr = [1, 3, 7]
27-
summaryRanges.getIntervals(); // return [[1, 1], [3, 3], [7, 7]]
28-
summaryRanges.addNum(2); // arr = [1, 2, 3, 7]
29-
summaryRanges.getIntervals(); // return [[1, 3], [7, 7]]
30-
summaryRanges.addNum(6); // arr = [1, 2, 3, 6, 7]
31-
summaryRanges.getIntervals(); // return [[1, 3], [6, 7]]
32-
```
23+
24+
SummaryRanges summaryRanges = new SummaryRanges();
25+
summaryRanges.addNum(1); // arr = [1]
26+
summaryRanges.getIntervals(); // return [[1, 1]]
27+
summaryRanges.addNum(3); // arr = [1, 3]
28+
summaryRanges.getIntervals(); // return [[1, 1], [3, 3]]
29+
summaryRanges.addNum(7); // arr = [1, 3, 7]
30+
summaryRanges.getIntervals(); // return [[1, 1], [3, 3], [7, 7]]
31+
summaryRanges.addNum(2); // arr = [1, 2, 3, 7]
32+
summaryRanges.getIntervals(); // return [[1, 3], [7, 7]]
33+
summaryRanges.addNum(6); // arr = [1, 2, 3, 6, 7]
34+
summaryRanges.getIntervals(); // return [[1, 3], [6, 7]]
3335

3436
**Constraints:**
3537

3638
* <code>0 <= val <= 10<sup>4</sup></code>
3739
* At most <code>3 * 10<sup>4</sup></code> calls will be made to `addNum` and `getIntervals`.
3840

39-
**Follow up:** What if there are lots of merges and the number of disjoint intervals is small compared to the size of the data stream?
41+
**Follow up:** What if there are lots of merges and the number of disjoint intervals is small compared to the size of the data stream?

0 commit comments

Comments
 (0)