Not sure why this solution gets marked as incorrect. I haven't been able to stump it. Can you find something wrong?
function [tf] = pattern_recognition1(array)
L = length(array);
one=array(1:3:L); two=array(2:3:L); three=array(3:3:L);
check = ((length(one) + length(two) = length(three)) /length(one);
c1 = all(one == one(1)); c2 = all(two == two(1)); c3 = all(three == three(1));
if c1 ==1 && c2 == 1 && c3 == 1
if check == 3;
tf = 1;
else tf = 0;
else tf = 0;
Line 5, replace 2nd "=" with "==".
Swap the first and last columns
Test if a Number is a Palindrome without using any String Operations
Rotate a Matrix
CONVERT TAN TO SIN
Pattern Recognition 3 - Variable Unit and Array Length (including cell arrays)
Rule of mixtures (composites) - weighted bound
Self-similarity 1 - Every other term
Weighted Gold/Silver Standard
Lights Out 8 - 5x5, light-only solution? I
Divisible by n, prime divisors from 20 to 200
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office