Cody

Solution 566532

Submitted on 27 Jan 2015 by Yannick
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))

n = 1 max = 2 max = 3 max = 4 a = 4 2 3 1 n = 2 max = 3 a = 4 3 2 1 n = 3 n = 4

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

n = 1 n = 2 n = 3 max = 6.4000 a = -4 -3 10 -1 0 1 2 3 4 5 6 7 8 9 -2 n = 4 max = 5.4000 max = 5.6000 a = -4 -3 10 -2 0 1 2 3 4 5 6 7 8 9 -1 n = 5 max = 4.4000 max = 5.4000 a = -4 -3 10 -2 9 1 2 3 4 5 6 7 8 0 -1 n = 6 max = 3.4000 max = 4.4000 max = 4.6000 a = -4 -3 10 -2 9 -1 2 3 4 5 6 7 8 0 1 n = 7 max = 2.4000 max = 3.4000 max = 4.4000 a = -4 -3 10 -2 9 -1 8 3 4 5 6 7 2 0 1 n = 8 max = 1.4000 max = 2.4000 max = 3.4000 max = 3.6000 a = -4 -3 10 -2 9 -1 8 0 4 5 6 7 2 3 1 n = 9 max = 1.4000 max = 2.4000 max = 3.4000 a = -4 -3 10 -2 9 -1 8 0 7 5 6 4 2 3 1 n = 10 max = 2.4000 max = 2.6000 a = -4 -3 10 -2 9 -1 8 0 7 1 6 4 2 3 5 n = 11 n = 12 max = 1.6000 a = -4 -3 10 -2 9 -1 8 0 7 1 6 2 4 3 5 n = 13 max = 0.6000 max = 1.4000 a = -4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4 n = 14 n = 15

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

n = 1

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

n = 1 n = 2 n = 3 n = 4 n = 5 n = 6