Cody

Solution 1250139

Submitted on 12 Aug 2017
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
A=[5 8 2 4;1 11 1 5] ; B_correct = [2 8 5 4;1 5 1 11]; assert(isequal(SrtPrimesInRows(A),B_correct))

indices = 2×4 logical array 1 0 1 0 0 1 0 1 C = 5 0 2 0 0 11 0 5 C = 0 0 2 5 0 0 5 11 revindices = 2×4 logical array 0 1 0 1 1 0 1 0 A = 0 8 0 4 1 0 1 0 B = 0 8 2 9 1 0 6 11

Assertion failed.

2   Pass
A=[2 7 5; 1 11 2;2 2 2]; B_correct=[2 5 7;1 2 11;2 2 2]; assert(isequal(SrtPrimesInRows(A),B_correct))

indices = 3×3 logical array 1 1 1 0 1 1 1 1 1 C = 2 7 5 0 11 2 2 2 2 C = 2 5 7 0 2 11 2 2 2 revindices = 3×3 logical array 0 0 0 1 0 0 0 0 0 A = 0 0 0 1 0 0 0 0 0 B = 2 5 7 1 2 11 2 2 2

3   Pass
A=[111 12 134;333 654 100000;112227 38 1]; B_correct=A; assert(isequal(SrtPrimesInRows(A),B_correct))

indices = 3×3 logical array 0 0 0 0 0 0 0 0 0 C = 0 0 0 0 0 0 0 0 0 C = 0 0 0 0 0 0 0 0 0 revindices = 3×3 logical array 1 1 1 1 1 1 1 1 1 A = 111 12 134 333 654 100000 112227 38 1 B = 111 12 134 333 654 100000 112227 38 1

Suggested Problems