Beispiel #1
0
int main(int argc, char const *argv[])
{
	SummaryRanges sr;
	sr.addNum(1);
	printRange(sr.getIntervals());
	sr.addNum(3);
	printRange(sr.getIntervals());
	sr.addNum(7);
	printRange(sr.getIntervals());
	sr.addNum(2);
	printRange(sr.getIntervals());
	sr.addNum(6);
	printRange(sr.getIntervals());
	return 0;
}
 void test() {
     SummaryRanges obj;
     //vector<int> input = {1, 3, 7, 2, 6};
     vector<int> input = {6, 6, 0, 4, 8, 7, 6, 4, 7, 5};
     for (int &val : input) {
         obj.addNum(val);
         for (Interval &inter : obj.getIntervals())
             cout << inter << " ";
         cout << endl;
     }
 }