Cody

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

Solution 1714966

Submitted on 24 Jan 2019 by Valentin Noël-Youïnou
• Size: 10
• 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
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 [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 findRowPattern (line 2) In ScoringEngineTestPoint1 (line 12) In solutionTest (line 3)]

2   Pass
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 [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 findRowPattern (line 2) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)]

3   Pass
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 [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 findRowPattern (line 2) In ScoringEngineTestPoint3 (line 9) In solutionTest (line 7)]

4   Pass
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 [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 findRowPattern (line 2) In ScoringEngineTestPoint4 (line 10) In solutionTest (line 9)]

5   Pass
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 [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 findRowPattern (line 2) In ScoringEngineTestPoint5 (line 16) In solutionTest (line 11)]

6   Pass
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 [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 findRowPattern (line 2) In ScoringEngineTestPoint6 (line 27) In solutionTest (line 13)]