Cody

# Problem 45236. Queen's move

Solution 2168349

Submitted on 21 Mar 2020 by Nikolaos Nikolaou
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 = {'Qd1','Qd5','Qf7','Qa8','Qg8'}; y_correct = [1,1,1,0,1]; assert(isequal(Queen_move(x),y_correct))

t = 4 8 D3 = 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 y = 1 1 t = 4 4 D3 = 1 0 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 y = 1 1 1 t = 6 2 D3 = 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 y = 1 1 1 0 position = 4 8 4 4 1 1 7 1 6 2 t = 7 1 D3 = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 y = 1 1 1 0 1

2   Pass
x = {'Qd1','Qd5','Qf7','Qa8','Qc7'}; y_correct = [1,1,1,0,1]; assert(isequal(Queen_move(x),y_correct))

t = 4 8 D3 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1 0 0 0 0 1 y = 1 0 1 0 0 0 1 y = 1 0 0 0 0 0 1 y = 1 0 0 0 0 1 1 y = 1 0 0 0 0 1 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!