This solution is outdated. To rescore this solution, sign in.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
filetext = fileread('bridgeRiddle.m');
assert(isempty(strfind(filetext, 'assert')))
assert(isempty(strfind(filetext, 'echo')))
|
2 | Pass |
x = [1 1 1 1];
y_correct = 5;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
5
|
3 | Pass |
x = [1 1 1 10];
y_correct = 14;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
14
|
4 | Pass |
x = [1 2 5 8];
y_correct = 15;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
15
|
5 | Pass |
x = [1 2 5 10];
y_correct = 17;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
17
|
6 | Pass |
x = [1 2 5 11];
y_correct = 18;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
18
|
7 | Pass |
x = [2 5 9 11];
y_correct = 28;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
28
|
8 | Pass |
x = [3 8 13 16];
y_correct = 43;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
43
|
9 | Pass |
x = [7 13 15 16];
y_correct = 58;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
58
|
10 | Pass |
x = [3 34 43 47];
y_correct = 130;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
130
|
11 | Pass |
x = [21 35 38 39];
y_correct = 154;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
154
|
12 | Pass |
x = [5 10 34 36];
y_correct = 71;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
71
|
13 | Pass |
x = [ 55 97 154 193];
y_correct = 539;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
539
|
14 | Pass |
x = [107 116 165 170];
y_correct = 625;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
625
|
15 | Pass |
x = [329 592 611 641];
y_correct = 2502;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
2502
|
16 | Pass |
x = [3259 4164 5259 6544];
y_correct = 22295;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
22295
|
17 | Pass |
x = [5947 6267 8477 9254];
y_correct = 34002;
assert(isequal(bridgeRiddle(x),y_correct))
fi =
function_handle with value:
@(i)i(2)+i(1)+i(4)+i(2)+i(2)
fj =
function_handle with value:
@(j)sum(j(2:4))+2*j(1)
y =
34002
|
Back to basics 25 - Valid variable names
293 Solvers
Pig Latin to English Translator
61 Solvers
130 Solvers
Remove element(s) from cell array
373 Solvers
Side of an equilateral triangle
2596 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!