Cody

# Problem 45427. King's Cage

Solution 2197437

Submitted on 7 Apr 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))

ans = 4 4

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test1 (line 3) assert(isequal( king(x,y),4))

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

ans = 4 3

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test2 (line 3) assert(isequal( king(x,y),4))

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

ans = 0 4

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test3 (line 3) assert(isequal( king(x,y),4))

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

ans = 6 5

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test4 (line 3) assert(isequal( king(x,y),6))

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

ans = 5 7

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test5 (line 3) assert(isequal( king(x,y),7))

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

ans = 7 1

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test6 (line 3) assert(isequal( king(x,y),7))

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

ans = 0 0

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test7 (line 3) assert(isequal( king(x,y),0))

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

ans = 2 0

Output argument "i" (and maybe others) not assigned during call to "king". Error in Test8 (line 3) assert(isequal( king(x,y),2))

### Community Treasure Hunt

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

Start Hunting!