Cody

Problem 43036. Non trivial identities - flipping

Solution 2652641

Submitted on 4 Jul 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
for k=1:20 x=randperm(k); assert(isequal(identity(x),x)); end assert(~isempty(strfind(fileread('identity.m'), 'flip')),'use flip')

y = 1 y = 2 1 y = 2 1 3 y = 2 3 4 1 y = 2 5 1 4 3 y = 5 3 4 1 6 2 y = 2 4 3 6 1 5 7 y = 5 1 6 3 4 7 2 8 y = 5 7 3 8 4 9 6 1 2 y = 7 9 4 5 8 1 10 6 2 3 y = 8 10 11 3 2 4 5 9 6 1 7 y = 11 5 8 9 3 1 6 2 10 12 7 4 y = 11 13 2 10 3 4 1 12 7 6 8 5 9 y = 9 4 1 10 12 2 13 8 14 7 5 6 11 3 y = 15 10 7 12 6 14 2 5 8 11 1 9 3 13 4 y = 12 2 10 3 5 8 11 6 15 4 14 1 13 16 7 9 y = 14 11 2 6 13 1 4 7 16 8 12 15 17 9 10 3 5 y = 15 18 8 13 12 3 6 17 11 4 9 10 5 7 1 14 2 16 y = 17 8 1 7 12 13 4 9 11 19 15 18 5 2 16 6 14 3 10 y = 2 20 8 7 19 4 12 1 5 14 15 6 13 9 3 11 16 17 10 18

use flip

Suggested Problems

More from this Author14

Community Treasure Hunt

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

Start Hunting!