Cody

Problem 44058. No more zeros

Solution 1997190

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 x = NaN NaN NaN NaN NaN 1 2 5 1 0 2 5 80 x = 1 2 5 1 0 2 5 80

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.6715 1.9892 1.8696 1.8820 1.8522 1.2141 1.9449 1.3322 1.4797 1.3746 x = NaN 0 0 1.6715 1.9892 1.8696 1.8820 1.8522 1.2141 1.9449 1.3322 1.4797 1.3746 x = NaN NaN 0 1.6715 1.9892 1.8696 1.8820 1.8522 1.2141 1.9449 1.3322 1.4797 1.3746 x = NaN NaN NaN 1.6715 1.9892 1.8696 1.8820 1.8522 1.2141 1.9449 1.3322 1.4797 1.3746 x = 1.3746 1.4797 1.3322 1.9449 1.2141 1.8522 1.8820 1.8696 1.9892 1.6715 NaN NaN NaN x = 1.3746 1.4797 1.3322 1.9449 1.2141 1.8522 1.8820 1.8696 1.9892 1.6715

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 x = NaN 1 2 3 4 5 6 7 8 9 10 x = 1 2 3 4 5 6 7 8 9 10

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 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 x = 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

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 x = NaN NaN NaN NaN 1 NaN NaN x = 1

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 x = 1 NaN NaN NaN NaN NaN NaN x = 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))