need to add non-sorted test samples (e.g. [3,2,1])?
It looks like 1 is being incorrectly sorted as a composite number in the testcases.
I somehow Alfonso's older comment until I saw Tom's newer one.
Alfonso: I've added a non-sorted test sample, and had the problem rescored.
Tom: 1 is neither prime nor composite. I've added instructions on how to handle that.
I had assumed that "in order" meant "in the order provided". If that were the case, then [5 1 3 2 4] would return [5 3 2 1 4]. Maybe you could say you want them sorted rather than in order.
Maybe a test case with a non-sorted input would be nice
Find the two-word state names
Getting the indices from a vector
Getting the row and column location from a matrix
Sum of diagonals elements of a matrix
Solving Quadratic Equations (Version 1)
All your base are belong to us
Figurate number triangle
Are you in or are you out?
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