Cody

# Problem 3108. Don't Try, give up and return NaN.

Solution 1990296

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))

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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))

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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))

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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))

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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))

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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))

Error in solution: Line: 6 Column: 27 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.