Cody

# Problem 795. Joining Ranges

Solution 1761891

Submitted on 26 Mar 2019 by Abdelfatah Teamah
• Size: 7
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = [0 5; 10 3; 20 15; 16 19; 25 25]; y_correct = [0 10;15 20;25 25]; assert(isequal(joinRanges(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In joinRanges (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

2   Pass
x = [-10 -5; 0 -8; -1 5]; y_correct = [-10 5]; assert(isequal(joinRanges(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In joinRanges (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

3   Pass
x = [-50 0; 0 50; 100 50; -50 -100]; y_correct = [-100 100]; assert(isequal(joinRanges(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In joinRanges (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

4   Pass
x = [99 51; -49 -1; -51 -99; 1 49]; y_correct = [-99 -51;-49 -1;1 49;51 99]; assert(isequal(joinRanges(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In joinRanges (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

5   Pass
x = [-inf inf]; y_correct = x; assert(isequal(joinRanges(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In joinRanges (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

6   Pass
x = [0 -42; -inf -10; inf 42]; y_correct = [-Inf 0;42 Inf]; assert(isequal(joinRanges(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In joinRanges (line 2) In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]

7   Pass
x = [36.154 63.178; 12.007 -5.156; -0.519 17.651]; y_correct = [-5.156 17.651;36.154 63.178]; assert(isequal(joinRanges(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In joinRanges (line 2) In ScoringEngineTestPoint7 (line 3) In solutionTest (line 15)]

8   Pass
assert(isempty(strfind(evalc('type joinRanges'), 'regexp')));