Cody

# Problem 3068. Pattern Recognition 1 - Known Unit Length

Solution 1956711

Submitted on 2 Oct 2019 by Augusto Mazzei
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
array = [1 2 3 1 2 3 1 2 3]; tf = 1; assert(isequal(pattern_recognition1(array),tf))

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

11   Pass
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))

ans = logical 0

12   Pass
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))

ans = logical 0