Cody

# Problem 803. Twist 'n' Match

Solution 1138413

Submitted on 13 Mar 2017 by mohammad z
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
n = 2; m = 1; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

2   Pass
n = 3; m = 7; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

3   Pass
n = 6; m = 6; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

4   Pass
n = 10; m = 11; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

5   Pass
n = 10; m = 14; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

6   Pass
n = 20; m = 83; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));

7   Pass
n = 21; m = 1; a = twist_n_match(n,m); [r,c] = size(a); assert(r==n && c==n); assert(isequal(nnz(a==rot90(a)),m));