Problem 16. Return the largest number that is adjacent to a zero

Created by Cody Team in Community

This example comes from Steve Eddins' blog: Learning Lessons from a One-Liner

Write a function that takes a list or array of numbers as input and return the largest number that is adjacent to a zero.


 Input  x = [1 5 3 0 2 7 0 8 9 1 0]
 Output y is 8

This problem was originally posed by Greg Wilson of Software Carpentry.

Solution Stats

30.48% Correct | 69.52% Incorrect
Last solution submitted on Mar 22, 2019

Problem Comments

Solution Comments

Recent Solvers2804

Suggested Problems

More from this Author95


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!