Given an array with zeros at the beginning or at the end, you should get the output without these zeros:
input = [zeros(5, 1); [1 2 5 1 0 2 5 80]']; output = [1 2 5 1 0 2 5 80]';
or
input = [5 7 6 2 2 0 0 0 0]; output = [5 7 6 2 2];
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers54
Suggested Problems
-
Return the largest number that is adjacent to a zero
5514 Solvers
-
Maximum running product for a string of numbers
2253 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1305 Solvers
-
1344 Solvers
-
The sum of the numbers in the vector
642 Solvers
More from this Author4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
The test suite has fixed and expanded.