Problem 16. Return the largest number that is adjacent to a zero
Solution Stats
Problem Comments
-
4 Comments
Show
1 older comment
Gaik Tamazian
on 17 Feb 2012
Two more tests:
1. Input x = [-4 -2 0 -4 -1 0]
Output y is -1.
2. Input x = [-9 -3 0 0 -5 0 -2 -1]
Output y is -2.
Geoff
on 8 May 2012
Good comment, Gaik. A lot of solutions (including mine) will break with two consecutive zeros.
Nicolae Preda
on 23 Sep 2013
Why: "Input x = [-9 -3 0 0 -5 0 -2 -1] Output y is -2."???
Output should be 0. It doesn't say anywhere that the number adjacent to a zero must be nonzero!
Kendale Greenidge-Bullock
on 8 Dec 2017
This was challenging
Solution Comments
Show commentsProblem Recent Solvers4873
Suggested Problems
-
Find relatively common elements in matrix rows
1748 Solvers
-
Find the two most distant points
2496 Solvers
-
593 Solvers
-
3881 Solvers
-
5648 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!