Cody

Solution 796781

Submitted on 21 Dec 2015 by Are Mjaavatten
  • Size: 76
  • This is the leading solution.
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 = [ 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0]; nCycles = 6; assert(isequal(count_undirected_cycles(A),nCycles))

2   Pass
%% A = [ 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 0 1 1 1 1 0]; nCycles = 136; assert(isequal(count_undirected_cycles(A),nCycles))

3   Pass
%% A = [ 0 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 1 0 1 0 1 0 0 0 1 0]; nCycles = 251; assert(isequal(count_undirected_cycles(A),nCycles))

4   Pass
%% A = [ 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 0 1 1 0]; nCycles = 1579; assert(isequal(count_undirected_cycles(A),nCycles)) A = [ 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 1 0]; nCycles = 147; assert(isequal(count_undirected_cycles(A),nCycles))