Cody

Solution 1048251

Submitted on 8 Nov 2016 by shahin rmz
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
a = [1 2 3 4]; t = 0; b_correct = [4 3 2 1]; assert(isequal(targetSort(a,t),b_correct))

b = [] b = 4 a = 1 2 3 b = 4 3 a = 1 2 b = 4 3 2 a = 1 b = 4 3 2 1 a = 1×0 empty double row vector

2   Pass
a = -4:10; t = 3.6; b_correct = [-4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4]; assert(isequal(targetSort(a,t),b_correct))

b = [] b = -4 a = -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 b = -4 -3 a = -2 -1 0 1 2 3 4 5 6 7 8 9 10 b = -4 -3 10 a = -2 -1 0 1 2 3 4 5 6 7 8 9 b = -4 -3 10 -2 a = -1 0 1 2 3 4 5 6 7 8 9 b = -4 -3 10 -2 9 a = -1 0 1 2 3 4 5 6 7 8 b = -4 -3 10 -2 9 -1 a = 0 1 2 3 4 5 6 7 8 b = -4 -3 10 -2 9 -1 8 a = 0 1 2 3 4 5 6 7 b = -4 -3 10 -2 9 -1 8 0 a = 1 2 3 4 5 6 7 b = -4 -3 10 -2 9 -1 8 0 7 a = 1 2 3 4 5 6 b = -4 -3 10 -2 9 -1 8 0 7 1 a = 2 3 4 5 6 b = -4 -3 10 -2 9 -1 8 0 7 1 6 a = 2 3 4 5 b = -4 -3 10 -2 9 -1 8 0 7 1 6 2 a = 3 4 5 b = -4 -3 10 -2 9 -1 8 0 7 1 6 2 5 a = 3 4 b = -4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 a = 4 b = -4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4 a = 1×0 empty double row vector

3   Pass
a = 12; t = pi; b_correct = 12; assert(isequal(targetSort(a,t),b_correct))

b = [] b = 12 a = 1×0 empty double row vector

4   Pass
a = -100:-95; t = 100; b_correct = [-100 -99 -98 -97 -96 -95]; assert(isequal(targetSort(a,t),b_correct))

b = [] b = -100 a = -99 -98 -97 -96 -95 b = -100 -99 a = -98 -97 -96 -95 b = -100 -99 -98 a = -97 -96 -95 b = -100 -99 -98 -97 a = -96 -95 b = -100 -99 -98 -97 -96 a = -95 b = -100 -99 -98 -97 -96 -95 a = 1×0 empty double row vector