Cody

# Problem 45329. Castling-01

Solution 2188849

Submitted on 2 Apr 2020 by Binbin Qi
• Size: 34
• 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={'Ra1','Ka7'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Ra1'} {'Ka7'}

2   Pass
a={'Ra1','Rh1'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Ra1'} {'Rh1'}

3   Pass
a={'Ra1','Rh1','Kh8'} assert(isequal(castling_01(a),0))

a = 1×3 cell array {'Ra1'} {'Rh1'} {'Kh8'}

4   Pass
a={'Ra1','Rc1','Kh5'} assert(isequal(castling_01(a),0))

a = 1×3 cell array {'Ra1'} {'Rc1'} {'Kh5'}

5   Pass
a={'Ra1','Rh1','Ke1'} assert(isequal(castling_01(a),1))

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

6   Pass
a={'Ra1','Rh1','Ke1'} assert(isequal(castling_01(a),1))

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

7   Pass
a={'Rh1','Ke1'} assert(isequal(castling_01(a),1))

a = 1×2 cell array {'Rh1'} {'Ke1'}

8   Pass
a={'Rh5','Ke5'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Rh5'} {'Ke5'}

9   Pass
a={'Ra8','Ke8'} assert(isequal(castling_01(a),1))

a = 1×2 cell array {'Ra8'} {'Ke8'}

10   Pass
a={'Rd8','Rh8','Ke8'} assert(isequal(castling_01(a),1))

a = 1×3 cell array {'Rd8'} {'Rh8'} {'Ke8'}

11   Pass
a={'Rh8','Kd8'} assert(isequal(castling_01(a),0))

a = 1×2 cell array {'Rh8'} {'Kd8'}