Cody

Solution 104978

Submitted on 29 Jun 2012
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, log in.

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(jointRanges(x),y_correct))
x = 0 5 3 10 15 20 16 19 25 25 xs = 0 3 5 10 15 16 19 20 25 25 0 f = 1 0 0 -1 1 0 0 -1 1 -1 0 y = 0 10 15 20 25 25
2   Pass
%% x = [-10 -5; 0 -8; -1 5]; y_correct = [-10 5]; assert(isequal(jointRanges(x),y_correct))
x = -10 -5 -8 0 -1 5 xs = -10 -8 -5 -1 0 5 0 f = 1 0 0 0 0 -1 0 y = -10 5
3   Pass
%% x = [-50 0; 0 50; 100 50; -50 -100]; y_correct = [-100 100]; assert(isequal(jointRanges(x),y_correct))
x = -50 0 0 50 50 100 -100 -50 xs = -100 -50 -50 0 0 50 50 100 0 f = 1 0 0 0 0 0 0 -1 0 y = -100 100
4   Pass
%% x = [99 51; -49 -1; -51 -99; 1 49]; y_correct = [-99 -51;-49 -1;1 49;51 99]; assert(isequal(jointRanges(x),y_correct))
x = 51 99 -49 -1 -99 -51 1 49 xs = -99 -51 -49 -1 1 49 51 99 0 f = 1 -1 1 -1 1 -1 1 -1 0 y = -99 -51 -49 -1 1 49 51 99
5   Fail
%% x = [-inf inf]; y_correct = x; assert(isequal(jointRanges(x),y_correct))
Error: Assertion failed.
6   Pass
%% x = [0 -42; -inf -10; inf 42]; y_correct = [-Inf 0;42 Inf]; assert(isequal(jointRanges(x),y_correct))
x = -42 0 -Inf -10 42 Inf xs = -Inf -42 -10 0 42 Inf 0 f = 1 0 0 -1 1 -1 0 y = -Inf 0 42 Inf
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(jointRanges(x),y_correct))
x = 36.1540 63.1780 -5.1560 12.0070 -0.5190 17.6510 xs = -5.1560 -0.5190 12.0070 17.6510 36.1540 63.1780 0 f = 1 0 0 -1 1 -1 0 y = -5.1560 17.6510 36.1540 63.1780