Example; A = [1 2 3 -3 -4 -1 -24 2 4 -1 -2 3 1];
ans;
[1 2 0 -3 -4 -1 0 2 0 -1 0 3 1]
Solution Stats
Problem Comments
5 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers6
Suggested Problems
-
Determine whether a vector is monotonically increasing
22846 Solvers
-
Who knows the last digit of pi?
689 Solvers
-
convert matrix to single column
433 Solvers
-
541 Solvers
-
Compute LOG(1+X) in natural log
263 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Test suite updated with additional test cases
I might be misunderstanding this problem, but I think the fourth and fifth tests have errors. The answer for the fourth should have a zero in the first position, not the second. The answer for the fifth test has no zeros at all.
@Chris, the question asks to make the points zero where the neighbourhood elements are opposite in sign.
This really needs a better problem description --- the original author's intention is not at all clear.
(And in fact the original author's own solution does not pass the updated test suite anymore.)