Cody

Problem 45427. King's Cage

Solution 2295363

Submitted on 19 May 2020 by bainhome
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=[1,1]; y=[5,5]; assert(isequal( king(x,y),4))

2   Pass
x=[6,6]; y=[2,3]; assert(isequal( king(x,y),4))

3   Pass
x=[5,1]; y=[5,5]; assert(isequal( king(x,y),4))

4   Pass
x=[2,3]; y=[8,8]; assert(isequal( king(x,y),6))

5   Pass
x=[2,8]; y=[7,1]; assert(isequal( king(x,y),7))

6   Pass
x=[1,4]; y=[8,3]; assert(isequal( king(x,y),7))

7   Pass
x=[5,8]; y=[5,8]; assert(isequal( king(x,y),0))

8   Pass
x=[1,4]; y=[3,4]; assert(isequal( king(x,y),2))

Suggested Problems

More from this Author148