Cody

# Problem 1478. Hamiltonian Cycle

Solution 1942132

Submitted on 19 Sep 2019
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   Fail
A=[0 1 0 0 ; 0 0 1 0 ; 0 0 0 1 ; 1 0 0 0]; T=[1 2 3 4]; y_correct = true; assert(isequal(isHamiltoniaCycle(A,T),y_correct)) A=[0 1 0 0 ; 0 0 1 0 ; 0 0 0 1 ; 0 1 0 0]; T=[1 2 3 4]; y_correct = false; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

Index exceeds the number of array elements (5). Error in isHamiltoniaCycle (line 4) possible = prod(T(idx))*isequal(sort(T(1:end-1)),1:length(A)) Error in Test1 (line 4) assert(isequal(isHamiltoniaCycle(A,T),y_correct))

2   Fail
A=[0 1 0 1 ; 1 1 1 0 ; 0 1 1 0 ; 0 0 1 0]; T=[1 2 3 4]; y_correct = false; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

Index exceeds the number of array elements (5). Error in isHamiltoniaCycle (line 4) possible = prod(T(idx))*isequal(sort(T(1:end-1)),1:length(A)) Error in Test2 (line 4) assert(isequal(isHamiltoniaCycle(A,T),y_correct))

3   Fail
A=[0 1 0 1 ; 1 1 1 0 ; 0 1 1 0 ; 0 0 1 0]; T=[3 2 1 4 ]; y_correct = true; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

Index exceeds the number of array elements (5). Error in isHamiltoniaCycle (line 4) possible = prod(T(idx))*isequal(sort(T(1:end-1)),1:length(A)) Error in Test3 (line 4) assert(isequal(isHamiltoniaCycle(A,T),y_correct))

4   Fail
A=[0 1 0 1 ; 1 1 1 0 ; 0 1 1 0 ; 0 0 1 0]; T=[2 3 2 3 ]; y_correct = false; assert(isequal(isHamiltoniaCycle(A,T),y_correct))

Index exceeds the number of array elements (5). Error in isHamiltoniaCycle (line 4) possible = prod(T(idx))*isequal(sort(T(1:end-1)),1:length(A)) Error in Test4 (line 4) assert(isequal(isHamiltoniaCycle(A,T),y_correct))