Cody

Solution 192414

Submitted on 17 Jan 2013 by Aurelien Queffurust
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:9; y_correct = 1:10; assert(isequal(getrank(x),y_correct))
f = [] t = 0 1 2 3 4 5 6 7 8 9 g = 1 2 3 4 5 6 7 8 9 10 f = 1 f = 1 2 f = 1 2 3 f = 1 2 3 4 f = 1 2 3 4 5 f = 1 2 3 4 5 6 f = 1 2 3 4 5 6 7 f = 1 2 3 4 5 6 7 8 f = 1 2 3 4 5 6 7 8 9 f = 1 2 3 4 5 6 7 8 9 10
2   Pass
%% x = 9:-1:0; y_correct = 10:-1:1; assert(isequal(getrank(x),y_correct))
f = [] t = 0 1 2 3 4 5 6 7 8 9 g = 10 9 8 7 6 5 4 3 2 1 f = 0 0 0 0 0 0 0 0 0 1 f = 0 0 0 0 0 0 0 0 2 1 f = 0 0 0 0 0 0 0 3 2 1 f = 0 0 0 0 0 0 4 3 2 1 f = 0 0 0 0 0 5 4 3 2 1 f = 0 0 0 0 6 5 4 3 2 1 f = 0 0 0 7 6 5 4 3 2 1 f = 0 0 8 7 6 5 4 3 2 1 f = 0 9 8 7 6 5 4 3 2 1 f = 10 9 8 7 6 5 4 3 2 1
3   Pass
%% x = [.5 .8 .1 .9 .7]; y_correct = [2 4 1 5 3]; assert(isequal(getrank(x),y_correct))
f = [] t = 0.1000 0.5000 0.7000 0.8000 0.9000 g = 3 1 5 2 4 f = 0 0 1 f = 2 0 1 f = 2 0 1 0 3 f = 2 4 1 0 3 f = 2 4 1 5 3
4   Pass
%% x = [2 -1 7 -6 3 2]; y_correct = [3 2 6 1 5 4] ; assert(isequal(getrank(x),y_correct))
f = [] t = -6 -1 2 3 7 g = 4 2 6 5 3 t = -6.0000 -1.0000 2.0000 2.1000 3.0000 7.0000 g = 4 2 1 6 5 3 f = 0 0 0 1 f = 0 2 0 1 f = 3 2 0 1 f = 3 2 0 1 0 4 f = 3 2 0 1 5 4 f = 3 2 6 1 5 4