Cody

Solution 293920

Submitted on 1 Aug 2013 by Alfonso Nieto-Castanon
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 = [3 4 5 7 6 1 8 2]; y_correct = 2; assert(isequal(number_of_cycles(x),y_correct))
2   Pass
%% x = [2 3 4 1 5 6]; y_correct = 3; assert(isequal(number_of_cycles(x),y_correct))
3   Pass
%% x = [1]; y_correct = 1; assert(isequal(number_of_cycles(x),y_correct))
4   Pass
%% x = [1 2]; y_correct = 2; assert(isequal(number_of_cycles(x),y_correct))
5   Pass
%% x = [2 1]; y_correct = 1; assert(isequal(number_of_cycles(x),y_correct))
6   Pass
%% x = [4 5 7 6 8 2 1 3]; y_correct = 1; assert(isequal(number_of_cycles(x),y_correct))
7   Pass
%% x = [4 2 7 6 5 8 1 3]; y_correct = 3; assert(isequal(number_of_cycles(x),y_correct))
8   Pass
%% x = [3 4 1 2 6 5]; y_correct = 3; assert(isequal(number_of_cycles(x),y_correct))
9   Pass
%% x = [3 4 1 2 6 5 8 9 7]; y_correct = 4; assert(isequal(number_of_cycles(x),y_correct))
10   Pass
%% x = [3 4 1 2 6 5 8 9 7 10]; y_correct = 5; assert(isequal(number_of_cycles(x),y_correct))
11   Pass
%% x = [3 4 2 5 1 8 9 7 10 6]; y_correct = 2; assert(isequal(number_of_cycles(x),y_correct))
12   Pass
%% x = [3 4 2 5 1 8 9 7 10 6 11]; y_correct = 3; assert(isequal(number_of_cycles(x),y_correct))