Cody

# Problem 42619. Flip the right coin to survive!

Solution 767962

Submitted on 28 Oct 2015 by Peng Liu
• Size: 7
• This is the leading solution.
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
%% board = [ 1 1 0 1 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 0 0 1 0 1]; warden_key = [8 8]; flip_correct = [5 5]; assert(isequal(flip_survive(board,warden_key),flip_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

2   Pass
%% board = [ 1 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 1 1 1]; warden_key = [4 8]; flip_correct = [6 7]; assert(isequal(flip_survive(board,warden_key),flip_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

3   Pass
%% board = [ 1 1 1 0 1 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 1]; warden_key = [8 7]; flip_correct = [2 7]; assert(isequal(flip_survive(board,warden_key),flip_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

4   Pass
%% board = [ 0 0 0 1 1 1 1 0 0 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 0]; warden_key = [6 6]; flip_correct = [4 2]; assert(isequal(flip_survive(board,warden_key),flip_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

5   Pass
%% board = [ 0 0 1 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 0]; warden_key = [5 1]; flip_correct = [5 3]; assert(isequal(flip_survive(board,warden_key),flip_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

### Community Treasure Hunt

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

Start Hunting!