Cody

# Problem 43079. Check if two matrices are permutations of each other

Solution 1698521

Submitted on 22 Dec 2018 by HH
• Size: 9
• 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
x = [1 2 3; 4 5 6; 7 8 9] y = [3 5 6; 7 1 2; 4 9 8] isPerm = true; assert(isequal(isPermute(x,y),isPerm))

x = 1 2 3 4 5 6 7 8 9 y = 3 5 6 7 1 2 4 9 8 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isPermute (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)]

2   Pass
x = [1 2; 4 5; 7 8]; y = x'; isPerm = true; assert(isequal(isPermute(x,y),isPerm))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isPermute (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

3   Pass
x = 1:50; y = randperm(50); isPerm = true; assert(isequal(isPermute(x,y),isPerm))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isPermute (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)]

4   Pass
x = 2:51; y = randperm(50); isPerm = false; assert(isequal(isPermute(x,y),isPerm))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isPermute (line 2) In ScoringEngineTestPoint4 (line 4) In solutionTest (line 9)]

5   Pass
x = [1 2 3; 4 5 6; 7 8 9] y = [3 5; 7 1; 4 9] isPerm = false; assert(isequal(isPermute(x,y),isPerm))

x = 1 2 3 4 5 6 7 8 9 y = 3 5 7 1 4 9 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In isPermute (line 2) In ScoringEngineTestPoint5 (line 4) In solutionTest (line 11)]

### Community Treasure Hunt

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

Start Hunting!