Cody

Problem 45427. King's Cage

Solution 2915689

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

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

Assertion failed.

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!