nice exhaustive search
After some attempts, I reached also a kind of solution like this...
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
s1 = {'abcd','bcde','cdef','defg'};
assert(isequal(gobbledigook(s1),'dddd'))
s2_correct = 'dddd';
|
2 | Pass |
%%
s1 = {'aldfejk','czoa','vwy','abcde'};
assert(isequal(gobbledigook(s1),'love'))
s2_correct = 'love';
|
3 | Pass |
%%
s1 = {'some','help','check','viterbi','algorithm'};
assert(isequal(gobbledigook(s1),'eeeeg'))
s2_correct = 'eeeeg';
|
4 | Pass |
%%
s1 = {'ldjfac','deamv','fka','idlw','pqmfjavs'};
assert(isequal(gobbledigook(s1),'lmklm')|isequal(gobbledigook(s1),'aaadf'))
s2_correct = 'lmklm';
s2_correct = 'aaadf';
|
5 | Pass |
%%
% avoids look-up table hack
s1 = cellfun(@(x)char('a'-1+randi(26,1,5)),cell(1,7),'uniformoutput',false);
assert(all(any(bsxfun(@eq,gobbledigook(s1),cell2mat(cellfun(@(x)x',s1,'uniformoutput',false)))))&all(sum(abs(diff(double(gobbledigook(s1)))))<=sum(abs(diff(double(cell2mat(cellfun(@(x)x(randi(numel(x),1,1000))',s1,'uniformoutput',false))),1,2)),2)));
|
104 Solvers
Project Euler: Problem 1, Multiples of 3 and 5
1491 Solvers
What is the distance from point P(x,y) to the line Ax + By + C = 0?
277 Solvers
44 Solvers
177 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!