Cody

Problem 1865. MiniMax

Solution 464447

Submitted on 30 Jun 2014 by rifat
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 = magic(4); correct = 15; assert(isequal(minimax(A),correct))

ans = 15

2   Pass
%% A = magic(5); correct = 21; assert(isequal(minimax(A),correct))

ans = 21

3   Pass
%% A = magic(6); n = randi(1024); correct = 34; assert(isequal(minimax(A+n),correct+n))

ans = 825

4   Pass
%% A = [1 2 3; 0 4 5; 6 0 0]; correct = 5; assert(isequal(minimax(A),correct))

ans = 5

5   Pass
%% A = [1 2 3; 0 4 0; 6 0 5]; correct = 4; assert(isequal(minimax(A),correct))

ans = 4

6   Pass
%% A = rand(7)+diag(randperm(7)); assert(isequal(floor(minimax(A)),1))

ans = 1.9436

7   Pass
%% those may be difficult for some approaches B = [1 2 1; 0 1 0]; correct = 2; assert(isequal(minimax(B),correct))

ans = 2

8   Pass
%% B = magic(6)+magic(6)'; correct = 61; assert(isequal(minimax(B),correct)) % other test suggestions highly welcome

ans = 61