Cody

Solution 510060

Submitted on 7 Oct 2014 by Christian
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))

c = 1 a = 2 2 3 4 a = 2 1 3 4 c = 1 a = 2 3 3 4 a = 2 3 1 4 c = 1 a = 2 3 4 4 a = 2 3 4 1 c = 2 a = 3 3 4 1 a = 3 2 4 1 c = 2 a = 3 4 4 1 a = 3 4 2 1 c = 3 a = 4 4 2 1 a = 4 3 2 1 b = 4 3 2 1

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))

c = 4 a = -4 -3 -2 -1 0 1 2 3 5 5 6 7 8 9 10 a = -4 -3 -2 -1 0 1 2 3 5 4 6 7 8 9 10 c = 4 a = -4 -3 -2 -1 0 1 2 3 5 6 6 7 8 9 10 a = -4 -3 -2 -1 0 1 2 3 5 6 4 7 8 9 10 c = 4 a = -4 -3 -2 -1 0 1 2 3 5 6 7 7 8 9 10 a = -4 -3 -2 -1 0 1 2 3 5 6 7 4 8 9 10 c = 4 a = -4 -3 -2 -1 0 1 2 3 5 6 7 8 8 9 10 a = -4 -3 -2 -1 0 1 2 3 5 6 7 8 4 9 10 c = 4 a = -4 -3 -2 -1 0 1 2 3 5 6 7 8 9 9 10 a = -4 -3 -2 -1 0 1 2 3 5 6 7 8 9 4 10 c = 4 a = -4 -3 -2 -1 0 1 2 3 5 6 7 8 9 10 10 a = -4 -3 -2 -1 0 1 2 3 5 6 7 8 9 10 4 c = 3 a = -4 -3 -2 -1 0 1 2 5 5 6 7 8 9 10 4 a = -4 -3 -2 -1 0 1 2 5 3 6 7 8 9 10 4 c = 3 a = -4 -3 -2 -1 0 1 2 5 6 6 7 8 9 10 4 a = -4 -3 -2 -1 0 1 2 5 6 3 7 8 9 10 4 c = 3 a = -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 8 9 0 10 7 1 6 2 5 3 4 c = 0 a = -4 -3 -2 -1 8 9 10 10 7 1 6 2 5 3 4 a = -4 -3 -2 -1 8 9 10 0 7 1 6 2 5 3 4 c = 8 a = -4 -3 -2 -1 9 9 10 0 7 1 6 2 5 3 4 a = -4 -3 -2 -1 9 8 10 0 7 1 6 2 5 3 4 c = 8 a = -4 -3 -2 -1 9 10 10 0 7 1 6 2 5 3 4 a = -4 -3 -2 -1 9 10 8 0 7 1 6 2 5 3 4 c = -1 a = -4 -3 -2 9 9 10 8 0 7 1 6 2 5 3 4 a = -4 -3 -2 9 -1 10 8 0 7 1 6 2 5 3 4 c = -1 a = -4 -3 -2 9 10 10 8 0 7 1 6 2 5 3 4 a = -4 -3 -2 9 10 -1 8 0 7 1 6 2 5 3 4 c = 9 a = -4 -3 -2 10 10 -1 8 0 7 1 6 2 5 3 4 a = -4 -3 -2 10 9 -1 8 0 7 1 6 2 5 3 4 c = -2 a = -4 -3 10 10 9 -1 8 0 7 1 6 2 5 3 4 a = -4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4 b = -4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4

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

b = 12

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

b = -100 -99 -98 -97 -96 -95

Suggested Problems

More from this Author95