This solution is outdated. To rescore this solution, sign in.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
filetext = fileread('Ciph.m');
assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')
assert(isempty(strfind(filetext, 'if')),'if is forbidden')
|
2 | Pass |
r = 20;
x=[1 5 2 6];
y_correct =3748;
assert(isequal(Ciph(x,r),y_correct))
ans =
21 25 22 26
ans =
3 7 4 8
ans =
3748
|
3 | Pass |
r = 5;
x=[5 6 3 2 6];
y_correct =12872;
assert(isequal(Ciph(x,r),y_correct))
ans =
10 11 8 7 11
ans =
1 2 8 7 2
ans =
12872
|
4 | Pass |
r = 40;
x=[4 8 6 8 5];
y_correct =83139;
assert(isequal(Ciph(x,r),y_correct))
ans =
44 48 46 48 45
ans =
8 12 10 12 9
ans =
8 3 1 3 9
ans =
83139
|
5 | Pass |
r = 110;
x=[5 1 2 6 1 6 5 1 6 5];
y_correct =7348387387;
assert(isequal(Ciph(x,r),y_correct))
ans =
115 111 112 116 111 116 115 111 116 115
ans =
16 12 13 17 12 17 16 12 17 16
ans =
7 3 4 8 3 8 7 3 8 7
ans =
7.3484e+09
|
6 | Pass |
r = 10085;
x=[5 1 6 5 1 6 5 1 5];
y_correct =162162161;
assert(isequal(Ciph(x,r),y_correct))
ans =
10090 10086 10091 10090 10086 10091 10090 10086 10090
ans =
1009 1014 1010 1009 1014 1010 1009 1014 1009
ans =
109 105 101 109 105 101 109 105 109
ans =
19 15 11 19 15 11 19 15 19
ans =
10 6 2 10 6 2 10 6 10
ans =
1 6 2 1 6 2 1 6 1
ans =
162162161
|
Return a list sorted by number of occurrences
1504 Solvers
962 Solvers
133 Solvers
Change the sign of even index entries of the reversed vector
296 Solvers
173 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!