Cody

# Problem 79. DNA N-Gram Distribution

Solution 1843437

Submitted on 9 Jun 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
s = 'AACTGAACG'; n = 3; hifreq_correct = 'AAC'; assert(isequal(nGramFrequency(s,n),hifreq_correct))

Undefined function 'arrayfyn' for input arguments of type 'function_handle'. Error in nGramFrequency (line 2) s=arrayfyn(@(x) s(x:x+n-1),1:length(s)-n+1,'UniformOutput',false); Error in Test1 (line 4) assert(isequal(nGramFrequency(s,n),hifreq_correct))

2   Fail
s = 'dynamic routing service'; n = 2; hifreq_correct = 'ic'; assert(isequal(nGramFrequency(s,n),hifreq_correct))

Undefined function 'arrayfyn' for input arguments of type 'function_handle'. Error in nGramFrequency (line 2) s=arrayfyn(@(x) s(x:x+n-1),1:length(s)-n+1,'UniformOutput',false); Error in Test2 (line 4) assert(isequal(nGramFrequency(s,n),hifreq_correct))

3   Fail
s = 'Your veracity is exceeded by your sagacity.'; n = 5; hifreq_correct = 'acity'; assert(isequal(nGramFrequency(s,n),hifreq_correct))

Undefined function 'arrayfyn' for input arguments of type 'function_handle'. Error in nGramFrequency (line 2) s=arrayfyn(@(x) s(x:x+n-1),1:length(s)-n+1,'UniformOutput',false); Error in Test3 (line 4) assert(isequal(nGramFrequency(s,n),hifreq_correct))

4   Fail
s = 'AGCGAAGGAAGGATCACATTTCTCAGGACAAAGGCATTTCACTAATGGTT'; n = 3; hifreq_correct = 'AGG'; assert(isequal(nGramFrequency(s,n),hifreq_correct))

Undefined function 'arrayfyn' for input arguments of type 'function_handle'. Error in nGramFrequency (line 2) s=arrayfyn(@(x) s(x:x+n-1),1:length(s)-n+1,'UniformOutput',false); Error in Test4 (line 4) assert(isequal(nGramFrequency(s,n),hifreq_correct))

5   Fail
s = 'In short, in matters vegetable, animal, and mineral, I am the very model of a modern Major-General.'; n = 2; hifreq_correct = 'er'; assert(isequal(nGramFrequency(s,n),hifreq_correct))

Undefined function 'arrayfyn' for input arguments of type 'function_handle'. Error in nGramFrequency (line 2) s=arrayfyn(@(x) s(x:x+n-1),1:length(s)-n+1,'UniformOutput',false); Error in Test5 (line 4) assert(isequal(nGramFrequency(s,n),hifreq_correct))