Cody

# Problem 1740. Find number patterns in rows of a matrix...

Solution 2678492

Submitted on 11 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
p = [1 2 3 4 5; 2 3 4 5 1; 3 4 6 7 8; 1 2 4 3 5; 4 6 3 2 1]; v = 4; out = [1 2 3 4 4; 1 2 3 5 3; 1 2 4 5 3; 1 3 4 5 3; 2 3 4 5 3] assert(isequal(findRowPattern(p,v),out))

out = 1 2 3 4 4 1 2 3 5 3 1 2 4 5 3 1 3 4 5 3 2 3 4 5 3

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in findRowPattern (line 2) out = [p v]; Error in Test1 (line 12) assert(isequal(findRowPattern(p,v),out))

2   Fail
p = [1 2 3 4 9; 2 3 1 4 8] v = 4; out = [1 2 3 4 2] assert(isequal(findRowPattern(p,v),out))

p = 1 2 3 4 9 2 3 1 4 8 out = 1 2 3 4 2

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in findRowPattern (line 2) out = [p v]; Error in Test2 (line 5) assert(isequal(findRowPattern(p,v),out))

3   Fail
p = [1 2 3 4 9; 2 3 1 4 8; 3 4 2 7 1] v = 3; out = [1 2 3 3; 1 2 4 3; 1 3 4 3; 2 3 4 3] assert(isequal(findRowPattern(p,v),out))

p = 1 2 3 4 9 2 3 1 4 8 3 4 2 7 1 out = 1 2 3 3 1 2 4 3 1 3 4 3 2 3 4 3

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in findRowPattern (line 2) out = [p v]; Error in Test3 (line 9) assert(isequal(findRowPattern(p,v),out))

4   Fail
p = [1 2 3 4 9; 2 3 1 4 8] v = 2; out = [1 2 2; 1 3 2; 1 4 2; 2 3 2; 2 4 2; 3 4 2] assert(isequal(findRowPattern(p,v),out))

p = 1 2 3 4 9 2 3 1 4 8 out = 1 2 2 1 3 2 1 4 2 2 3 2 2 4 2 3 4 2

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in findRowPattern (line 2) out = [p v]; Error in Test4 (line 10) assert(isequal(findRowPattern(p,v),out))

5   Fail
p = [15 23 68 49 88; 69 58 78 21 35; 10 23 21 35 88; 99 58 63 24 10; 64 28 14 33 58; 85 69 21 45 55; 99 24 76 49 33; 89 69 33 98 21; 99 10 21 55 58; 35 68 69 44 21; 21 69 35 46 33]; v = 3; out = [21 35 69 3; 10 58 99 2; 21 33 69 2] assert(isequal(findRowPattern(p,v),out))

out = 21 35 69 3 10 58 99 2 21 33 69 2

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in findRowPattern (line 2) out = [p v]; Error in Test5 (line 16) assert(isequal(findRowPattern(p,v),out))

6   Fail
p = [15 23 68 49 88; 69 58 78 21 35; 10 23 21 35 88; 99 58 63 24 10; 64 28 14 33 58; 85 69 21 45 55; 99 24 76 49 33; 89 69 33 98 21; 99 10 21 55 58; 35 68 69 44 21; 21 69 35 46 33]; v = 2; out = [21 69 5; 21 35 4; 35 69 3; 10 21 2; 10 58 2; 10 99 2; 21 33 2; 21 55 2; 21 58 2; 23 88 2; 24 99 2; 33 69 2; 58 99 2] assert(isequal(findRowPattern(p,v),out))

out = 21 69 5 21 35 4 35 69 3 10 21 2 10 58 2 10 99 2 21 33 2 21 55 2 21 58 2 23 88 2 24 99 2 33 69 2 58 99 2

Error using horzcat Dimensions of arrays being concatenated are not consistent. Error in findRowPattern (line 2) out = [p v]; Error in Test6 (line 27) assert(isequal(findRowPattern(p,v),out))