Problem 3070. Pattern Recognition 3 - Variable Unit and Array Length (including cell arrays)
You will be given various arrays, composed of numbers or strings, including cell arrays of strings. For this problem, the pattern unit length is variable, ranging from three to half the array length (the unit will be completely repeated at least once). Write a function to determine if the supplied array is a strict repeating pattern. The array will not necessarily have a length that is a multiple of the unit length.
For example, [1 2 3 4 5 1 2 3 4 5 1 2 3] would return true since the first block (1:5) is strictly repeated through the remainder of the array (including the last [1 2 3]). On the other hand, 'abcabcabcabcabcabea' would return false, since the last complete block is 'abe' rather than 'abc', as indicated by the first block.
This problem is a follow-on to Problem 3068 and Problem 3069.
Solution Stats
Problem Comments
-
3 Comments
array = [1 10 100 1 10 1 10 100 1 10 100 1];
in test 18, this is false, I think it should true,and you?
The way I interpret it, the last (partial) segment in the sequence <1 10 100 1 10> <1 10 100 1 10> <100 1 ... does not match the expected pattern. The other alternative, sequence <1 10 100 1 10 1 10 100> <1 10 100 1...> has a correct partial match but it does not include a pattern that is repeated at least once...
thanks,I see
Solution Comments
Show commentsGroup

Strings II
- 21 Problems
- 41 Finishers
- Eliminate Polysyllabics: Long live short words!
- Alternately upper-lower case
- Morse Code Generator! Try it!
- Is the paranthesis sequence balanced ?
- Simple Decoder Ring
- Join Strings with Multiple Different Delimiters
- Is the paranthesis sequence balanced ?
- Count letters occurence in text, specific to words with a given length.
- Convert Two Character String into a Binary Vector
- Kryptos - CIA Cypher Sculpture: Vigenere Encryption
- Kryptos - CIA Cypher Sculpture: Vignere Decryption
- Mean and standard deviation of times in string
- How many digits are there?
- ABBREVIATION
- Make a list string
- Generate a melodic contour string matrix
- Morse Code Generator! Try it!
- NO _________ ALLOWED....
- Backslang, odds are you used it at some point in time...
- Simple Caesar Cypher - shift encrypt a message given an index number
- Split a given string from the first instance of a given character
- Concatenate strings
- most frequent character
- Alternately upper-lower case
Problem Recent Solvers48
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!