Cody

Problem 3068. Pattern Recognition 1 - Known Unit Length

Solution 2468240

Submitted on 4 Jun 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
array = [1 2 3 1 2 3 1 2 3]; tf = 1; assert(isequal(pattern_recognition1(array),tf))

r = 1 2 3 1 2 3 1 2 3

Assertion failed.

2   Fail
array = [1 2 2 1 2 2]; tf = 1; assert(isequal(pattern_recognition1(array),tf))

r = 1 2 2 1 2 2

Assertion failed.

3   Fail
array = [1 10 100 1 10 100 1 10 100 1 10 100]; tf = 1; assert(isequal(pattern_recognition1(array),tf))

r = 1 10 100 1 10 100 1 10 100 1 10 100

Assertion failed.

4   Fail
array = 'abcabcadcabcabc'; tf = 0; assert(isequal(pattern_recognition1(array),tf))

r = 3×5 char array 'abcab' 'cadca' 'bcabc'

Assertion failed.

5   Fail
array = [1 2 3 1 2 3 2 2 3]; tf = 0; assert(isequal(pattern_recognition1(array),tf))

r = 1 2 3 1 2 3 2 2 3

Assertion failed.

6   Fail
array = 'hi hi hi '; tf = 1; assert(isequal(pattern_recognition1(array),tf))

r = 3×3 char array 'hi ' 'hi ' 'hi '

Assertion failed.

7   Fail
array = [1 2 2 1 2 1]; tf = 0; assert(isequal(pattern_recognition1(array),tf))

r = 1 2 2 1 2 1

Assertion failed.

8   Fail
array = 'abcabcabcabcabc'; tf = 1; assert(isequal(pattern_recognition1(array),tf))

r = 3×5 char array 'abcab' 'cabca' 'bcabc'

Assertion failed.

9   Fail
array = 'hi ho hi '; tf = 0; assert(isequal(pattern_recognition1(array),tf))

r = 3×3 char array 'hi ' 'ho ' 'hi '

Assertion failed.

10   Fail
array = [1 10 100 1 10 100 1 10 10 1 10 100]; tf = 0; assert(isequal(pattern_recognition1(array),tf))

r = 1 10 100 1 10 100 1 10 10 1 10 100

Assertion failed.

11   Fail
ind = randi(4); switch ind case 1 array = 'abcabcabcabcabc'; tf = 1; case 2 array = [1 10 100 1 10 100 1 10 10 1 10 100]; tf = 0; case 3 array = [1 2 2 1 2 2]; tf = 1; case 4 array = 'hi ho hi '; tf = 0; end assert(isequal(pattern_recognition1(array),tf))

r = 3×3 char array 'hi ' 'ho ' 'hi '

Assertion failed.

12   Fail
ind = randi(4); switch ind case 1 array = [1 2 3 1 2 3 2 2 3]; tf = 0; case 2 array = [1 10 100 1 10 100 1 10 100 1 10 100]; tf = 1; case 3 array = [1 2 3 1 2 3 2 2 3]; tf = 0; case 4 array = [1 2 2 1 2 2]; tf = 1; end assert(isequal(pattern_recognition1(array),tf))

r = 1 2 2 1 2 2

Assertion failed.

Suggested Problems

More from this Author139

Community Treasure Hunt

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

Start Hunting!