Same number of zeros for a given number in the vector,
if there is a negative number in vector, then insert zeros to precede that number
For example:
x = [1 2 3 4 5]
y_correct = [1 0 2 0 0 3 0 0 0 4 0 0 0 0 5 0 0 0 0 0];
x = [1 -2 3 4 -5]
y_correct = [1 0 0 0 -2 3 0 0 0 4 0 0 0 0 0 0 0 0 0 -5];
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
The last test case doesn't actually check anything.