Cody

Problem 3061. Mirror, mirror on the wall, who is fairest of them all?

Solution 2088129

Submitted on 10 Jan 2020 by Jonathan
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=[2 1 1 1 1;0 2 1 1 1;0 0 2 1 1;0 0 0 2 1;0 0 0 0 2]; assert(isequal(fairest_girl(A),1064));

2   Pass
A=[2 1;0 2]; assert(isequal(fairest_girl(A),1016));

3   Pass
assert(isequal(fairest_girl([2 1 0.5;0 2 0.5;0.5 0.5 2]),1016));

4   Pass
A=[2 1 1 1 1 1;0 2 1 1 1 1;0 0 2 1 1 1;0 0 0 2 0.5 0.5;0 0 0 0.5 2 0.5;0 0 0 0.5 0.5 2]; assert(isequal(fairest_girl(A),1080));

5   Pass
A=[2 0.5 1;0.5 2 0.5;0 0.5 2]; assert(isequal(fairest_girl(A),1016));

6   Pass
A=[2 1 1 1 1 1 1;0 2 1 1 1 1 1;0 0 2 1 1 1 1;0 0 0 2 0.5 0.5 1;0 0 0 0.5 2 0.5 1;0 0 0 0.5 0.5 2 1;0 0 0 0 0 0 2]; assert(isequal(fairest_girl(A),1096));

7   Pass
A=[2 1 1 1 1 1 0.5;0 2 1 1 1 1 0.5;0 0 2 1 1 1 0.5;0 0 0 2 0.5 0.5 0.5;0 0 0 0.5 2 0.5 0.5;0 0 0 0.5 0.5 2 0.5;0.5 0.5 0.5 0.5 0.5 0.5 2]; assert(isequal(fairest_girl(A),1080));

Suggested Problems

More from this Author43

Community Treasure Hunt

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

Start Hunting!