Cody

# Problem 45330. Castling-02

Solution 2188860

Submitted on 2 Apr 2020 by Binbin Qi
• Size: 15
• 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={'Rd1','Rh1','Ke1'} assert(isequal(castling_02(a),1))

a = 1×3 cell array {'Rd1'} {'Rh1'} {'Ke1'}

2   Pass
a={'Rd1','Rd4','Ke1','Bb6'} assert(isequal(castling_02(a),0))

a = 1×4 cell array {'Rd1'} {'Rd4'} {'Ke1'} {'Bb6'}

3   Pass
a={'d1','Rh8','Kg1'} assert(isequal(castling_02(a),0))

a = 1×3 cell array {'d1'} {'Rh8'} {'Kg1'}

4   Pass
a={'Ra1','Rh1','Ke1','Qd1'} assert(isequal(castling_02(a),1))

a = 1×4 cell array {'Ra1'} {'Rh1'} {'Ke1'} {'Qd1'}

5   Pass
a={'Ra1','Rh1','Ke1','Qd1','Bg1'} assert(isequal(castling_02(a),0))

a = 1×5 cell array {'Ra1'} {'Rh1'} {'Ke1'} {'Qd1'} {'Bg1'}

6   Pass
a={'Ba2','Ra1','Rb1','Ke1','Bg1'} assert(isequal(castling_02(a),0))

a = 1×5 cell array {'Ba2'} {'Ra1'} {'Rb1'} {'Ke1'} {'Bg1'}

7   Pass
a={'Na1','Rh1','Ke1','Qd1'} assert(isequal(castling_02(a),1))

a = 1×4 cell array {'Na1'} {'Rh1'} {'Ke1'} {'Qd1'}

8   Pass
a={'Kd1','Qe1','Rh1','Rd8','a4','Nf2'} assert(isequal(castling_02(a),0))

a = 1×6 cell array {'Kd1'} {'Qe1'} {'Rh1'} {'Rd8'} {'a4'} {'Nf2'}