Cody

# Problem 79. DNA N-Gram Distribution

Solution 2647526

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

hifreq = 'AAC'

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

hifreq = 'ic'

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

hifreq = 'acity'

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

1×3×11 char array hifreq(:,:,1) = 'AAG' hifreq(:,:,2) = 'ACA' hifreq(:,:,3) = 'AGG' hifreq(:,:,4) = 'ATT' hifreq(:,:,5) = 'CAC' hifreq(:,:,6) = 'CAT' hifreq(:,:,7) = 'GAA' hifreq(:,:,8) = 'GGA' hifreq(:,:,9) = 'TCA' hifreq(:,:,10) = 'TTC' hifreq(:,:,11) = 'TTT'

Assertion failed.

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

1×2×15 char array hifreq(:,:,1) = ',a' hifreq(:,:,2) = 'al' hifreq(:,:,3) = 'am' hifreq(:,:,4) = 'an' hifreq(:,:,5) = 'de' hifreq(:,:,6) = 'er' hifreq(:,:,7) = 'in' hifreq(:,:,8) = 'l,' hifreq(:,:,9) = 'ma' hifreq(:,:,10) = 'mo' hifreq(:,:,11) = 'ne' hifreq(:,:,12) = 'od' hifreq(:,:,13) = 'or' hifreq(:,:,14) = 'ra' hifreq(:,:,15) = 've'

Assertion failed.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!