Problem 1451. Symmetry of vector
Solution Stats
Problem Comments
-
5 Comments
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.
Hello everyone,
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.
KR, Andrea
Solution Comments
Show commentsProblem Recent Solvers911
Suggested Problems
-
Remove all the words that end with "ain"
2181 Solvers
-
Count consecutive 0's in between values of 1
384 Solvers
-
1302 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
1736 Solvers
-
Given a square and a circle, please decide whether the square covers more area.
785 Solvers
More from this Author9
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!