-
5 Comments
Show
2 older comments
Paul Berglund
on 19 Aug 2013
This actually has a minor bug -- it may fail on inputs containing negative numbers, e.g. x=[1 -1], however this is simply fixable by taking abs(x).
Xiaoyi Chin
on 4 Oct 2017
wonderful solution
bainhome
on 23 Aug 2018
it never gets tired to watch this kinda code.
Suggested Problems
-
2283 Solvers
-
1357 Solvers
-
Fix the last element of a cell array
1551 Solvers
-
Integer Sequence - II : New Fibonacci
567 Solvers
-
Spot the First Occurrence of 5
421 Solvers
More from this Author17
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!