From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/data_stream_disjoint_interval.cpp | 45 --------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 other/data_stream_disjoint_interval.cpp (limited to 'other/data_stream_disjoint_interval.cpp') diff --git a/other/data_stream_disjoint_interval.cpp b/other/data_stream_disjoint_interval.cpp deleted file mode 100644 index 3682ee2..0000000 --- a/other/data_stream_disjoint_interval.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// 352. Data Stream as Disjoint Intervals -#include "leetcode.h" - -/* - * given a data stream input of non-negative integers 'a1, a2, ..., an', - * summarize the numbers seen so far as a list of disjoint intervals. implement - * 'SummaryRanges': SummaryRanges() initialises the object with an empty stream - * void addNum(int value) adds the integer 'value' to the stream - * int[][] getIntervals() returns a summary of the integers in the stream - * currently as a list of disjoint intervals '[starti, endi]'. sort answer by - * 'starti' - */ - -class SummaryRanges { -public: - map m; - void addNum(int value) { - if (m.count(value)) - return; - m[value] = value; - int mn = value, mx = value; - if (m.count(value - 1)) - mn = m[value - 1]; - if (m.count(value + 1)) - mx = m[value + 1]; - m[mn] = mx; - m[mx] = mn; - } - vvd getIntervals() { - vvd ans; - auto it = m.begin(); - while (it != m.end()) { - ans.push_back({it->first, it->second}); - it = m.upper_bound(it->second); - } - return ans; - } -}; - -int main() { - SummaryRanges *obj = new SummaryRanges(); - int value; - obj->addNum(value); - vvd param_2 = obj->getIntervals(); -} -- cgit v1.2.3