Pattern Recognition 1 - Known Unit Length - MATLAB Cody - MATLAB Central

Problem 3068. Pattern Recognition 1 - Known Unit Length

Difficulty:Rate

You will be given various arrays, composed of numbers or strings. For this problem, the known pattern unit length is three. Write a function to determine if the supplied array is a strict repeating pattern. The array will have a length that is a multiple of three.

For example, [1 2 3 1 2 3 1 2 3] would return true since the first block ([1 2 3]) is strictly repeated through the remainder of the array. On the other hand, [1 2 3 1 2 3 2 2 3] would return false, since the last block is [2 2 3] rather than [1 2 3], as indicated by the first block.

This problem is a precursor to Problem 3069 and Problem 3070.

Solution Stats

65.29% Correct | 34.71% Incorrect
Last Solution submitted on Jun 15, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
3
6

Problem Recent Solvers64

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!