Cody

# Problem 113. N-Queens Checker

Solution 2818033

Submitted on 11 Aug 2020
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 = [1 0 0; 0 0 1; 0 0 0]; tf_correct = true; assert(isequal(queens(a),tf_correct))

iRNr = 3 iRNc = 3

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test1 (line 3) assert(isequal(queens(a),tf_correct))

2   Fail
a = [0 0 0 1; 1 0 0 0; 0 0 1 0; 0 1 0 0]; tf_correct = false; assert(isequal(queens(a),tf_correct))

iRNr = 4 iRNc = 4

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test2 (line 3) assert(isequal(queens(a),tf_correct))

3   Fail
a = [1 0 0 0 0; 0 0 0 1 1]; tf_correct = false; assert(isequal(queens(a),tf_correct))

iRNr = 2 iRNc = 5

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test3 (line 3) assert(isequal(queens(a),tf_correct))

4   Fail
a = [ ... 0 0 1 0 0 0 0 0; 0 0 0 0 0 0 1 0; 0 1 0 0 0 0 0 0; 0 0 0 0 0 0 0 1; 0 0 0 0 0 1 0 0; 0 0 0 1 0 0 0 0; 1 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0]; tf_correct = true; assert(isequal(queens(a),tf_correct))

iRNr = 8 iRNc = 8

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test4 (line 5) assert(isequal(queens(a),tf_correct))

5   Fail
a = ones(15,7); tf_correct = false; assert(isequal(queens(a),tf_correct))

iRNr = 15 iRNc = 7

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test5 (line 3) assert(isequal(queens(a),tf_correct))

6   Fail
a = zeros(20,23); a(1,22) = 1; a(2,23) = 1; tf_correct = false; assert(isequal(queens(a),tf_correct))

iRNr = 20 iRNc = 23

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test6 (line 5) assert(isequal(queens(a),tf_correct))

7   Fail
a = [1 0; 0 1]; tf_correct = false; assert(isequal(queens(a),tf_correct))

iRNr = 2 iRNc = 2

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test7 (line 3) assert(isequal(queens(a),tf_correct))

8   Fail
a = [1 0 1; 0 0 0; 0 1 0]; tf_correct = false; assert(isequal(queens(a),tf_correct))

iRNr = 3 iRNc = 3

Index in position 1 exceeds array bounds (must not exceed 1). Error in queens (line 36) miniMatrix=a(cTop:cBottom,cLeft:cRight); Error in Test8 (line 3) assert(isequal(queens(a),tf_correct))