Case #3 is not symmetric...please check.
I fixed the wording.
Why the vector from "Test Suite" "Test 3" is symmetric?
x = [-1 0 0 1];
y_correct = 1; %% WHY 1?
I updated test case #3.
just a quick hint for this test: at the moment, one can pass this test simply checking whether x(1)==x(end).
However, to me at least, it makes more sense to split the check for even and odd vectors and to check if the corresponding symmetrical elements are the same or not.
If any of the pairs of elements are not equal, then we exit the cycle and we terminate with a false/0.
This is the way I figured out a robust check, otherwise it's just cheating.
Include a test case where first and last are same, but ones in middle aren't (say [1 2 4 3 5 2 1])
I need to learn more.
What if you update the test #3 in test suite?
Maximum running product for a string of numbers
Solve the set of simultaneous linear equations
Rotate a Matrix
The sum of the numbers in the vector
Duplicate a character
Moving average (variable kernel length)
Insert zeros into vector
Change the sign of even index entries of the reversed vector
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