Cody

Solution 1990301

Submitted on 25 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 = 10:-2:2; N = 5:-1:1; y_correct = 2:2:10; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

2   Fail
A = [1 2 3 4 10]; N = 5; y_correct = 10; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

3   Fail
A = 10:-2:2; N = -1; y_correct = NaN; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

4   Fail
A = [4 5 6]; N = [6 2]; y_correct = [NaN 5]; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

5   Fail
A = 4:randi([20 30]) ; N = randi(length(A)+20,1,10); K = N+3 ; K(K>max(A)) = NaN; y_correct = K; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

6   Fail
A = [-23 4 56 0 44 11]; N = [7:-1.5:-2]; y_correct = [NaN NaN 0 NaN -23 NaN NaN]; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

7   Fail
A = magic(3); N = magic(4); y_correct = [ NaN 3 4 NaN 5 NaN NaN 7 2 6 9 NaN 1 NaN NaN 8]; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

8   Fail
A = magic(3); N = magic(4)-1; y_correct = [ NaN 8 3 NaN 1 NaN 2 6 7 9 5 NaN 4 NaN NaN NaN]; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

9   Fail
A = magic(4); N = magic(3)-1; y_correct = [ 7 NaN 2 5 4 11 9 14 16]; assert(isequaln(giveup(A,N),y_correct))

values = NaN values = NaN 2 values = NaN 2 NaN

Error using reshape To RESHAPE the number of elements must not change. Error in giveup (line 9) values=reshape(values,size(A))

Suggested Problems

More from this Author41