Cody

# Problem 44058. No more zeros

Solution 1997188

Submitted on 31 Oct 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
a = zeros(5,1); b = [1 2 5 1 0 2 5 80]'; x = [a; b]; y_correct = b; assert(isequal(without_zeros(x),y_correct))

x = NaN 0 0 0 0 1 2 5 1 0 2 5 80 x = NaN NaN 0 0 0 1 2 5 1 0 2 5 80 x = NaN NaN NaN 0 0 1 2 5 1 0 2 5 80 x = NaN NaN NaN NaN 0 1 2 5 1 0 2 5 80 x = NaN NaN NaN NaN NaN 1 2 5 1 0 2 5 80 x = 80 5 2 0 1 5 2 1 NaN NaN NaN NaN NaN

Output argument "y" (and maybe others) not assigned during call to "without_zeros". Error in Test1 (line 5) assert(isequal(without_zeros(x),y_correct))

2   Fail
a = rand(1,10)+1; b = zeros(1,3); x = [a b]; y_correct = a; assert(isequal(without_zeros(x),y_correct))

x = 0 0 0 1.4130 1.2420 1.1638 1.6765 1.9920 1.7100 1.7442 1.2194 1.2547 1.9710 x = NaN 0 0 1.4130 1.2420 1.1638 1.6765 1.9920 1.7100 1.7442 1.2194 1.2547 1.9710 x = NaN NaN 0 1.4130 1.2420 1.1638 1.6765 1.9920 1.7100 1.7442 1.2194 1.2547 1.9710 x = NaN NaN NaN 1.4130 1.2420 1.1638 1.6765 1.9920 1.7100 1.7442 1.2194 1.2547 1.9710

Output argument "y" (and maybe others) not assigned during call to "without_zeros". Error in Test2 (line 5) assert(isequal(without_zeros(x),y_correct))

3   Fail
x = 0:10; y_correct = 1:10; assert(isequal(without_zeros(x),y_correct))

x = NaN 1 2 3 4 5 6 7 8 9 10 x = 10 9 8 7 6 5 4 3 2 1 NaN

Output argument "y" (and maybe others) not assigned during call to "without_zeros". Error in Test3 (line 3) assert(isequal(without_zeros(x),y_correct))

4   Fail
a = 0:10; b = 1:10; x = [a zeros(1,5) fliplr(a)]; y_correct = [b zeros(1,5) fliplr(b)]; assert(isequal(without_zeros(x),y_correct))

x = NaN 1 2 3 4 5 6 7 8 9 10 0 0 0 0 0 10 9 8 7 6 5 4 3 2 1 0 x = 0 1 2 3 4 5 6 7 8 9 10 0 0 0 0 0 10 9 8 7 6 5 4 3 2 1 NaN x = NaN 1 2 3 4 5 6 7 8 9 10 0 0 0 0 0 10 9 8 7 6 5 4 3 2 1 NaN

Output argument "y" (and maybe others) not assigned during call to "without_zeros". Error in Test4 (line 5) assert(isequal(without_zeros(x),y_correct))

5   Fail
x = [0 0 0 0 1 0 0]; y_correct = 1; assert(isequal(without_zeros(x),y_correct))

x = NaN 0 0 0 1 0 0 x = NaN NaN 0 0 1 0 0 x = NaN NaN NaN 0 1 0 0 x = NaN NaN NaN NaN 1 0 0 x = 0 0 1 NaN NaN NaN NaN x = NaN 0 1 NaN NaN NaN NaN x = NaN NaN 1 NaN NaN NaN NaN

Output argument "y" (and maybe others) not assigned during call to "without_zeros". Error in Test5 (line 3) assert(isequal(without_zeros(x),y_correct))

6   Fail
x = [1 0 0 0 0 0 0]; y_correct = 1; assert(isequal(without_zeros(x),y_correct))

x = 0 0 0 0 0 0 1 x = NaN 0 0 0 0 0 1 x = NaN NaN 0 0 0 0 1 x = NaN NaN NaN 0 0 0 1 x = NaN NaN NaN NaN 0 0 1 x = NaN NaN NaN NaN NaN 0 1 x = NaN NaN NaN NaN NaN NaN 1

Output argument "y" (and maybe others) not assigned during call to "without_zeros". Error in Test6 (line 3) assert(isequal(without_zeros(x),y_correct))