Cody

# Problem 79. DNA N-Gram Distribution

Solution 1236950

Submitted on 22 Jul 2017 by Augusto Mazzei
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))

M = 0 m = 2 hi = 65 65 67 M = 2 m = 1 hi = 65 65 67 M = 2 m = 1 hi = 65 65 67 M = 2 m = 1 hi = 65 65 67 M = 2 m = 1 hi = 65 65 67 M = 2 m = 2 hi = 65 65 67 M = 2 m = 1 hi = 65 65 67 M = 2

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

M = 0 m = 1 hi = 100 121 M = 1 m = 1 hi = 100 121 M = 1 m = 1 hi = 100 121 M = 1 m = 1 hi = 100 121 M = 1 m = 1 hi = 100 121 M = 1 m = 2 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2 m = 2 hi = 105 99 M = 2 m = 1 hi = 105 99 M = 2

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

M = 0 m = 1 hi = 89 111 117 114 32 M = 1 m = 1 hi = 89 111 117 114 32 M = 1 m = 1 hi = 89 111 117 114 32 M = 1 m = 1 hi = 89 111 117 114 32 M = 1 m = 1 hi = 89 111 117 114 32 M = 1 m = 1 hi = 89 111 117 114 32 M = 1 m = 1 hi = 89 111 117 114 32 M = 1 m = 1 hi = 89 111 117 114 32 M = 1 m = 2 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2 m = 2 hi = 97 99 105 116 121 M = 2 m = 1 hi = 97 99 105 116 121 M = 2

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

M = 0 m = 1 hi = 65 71 67 M = 1 m = 1 hi = 65 71 67 M = 1 m = 1 hi = 65 71 67 M = 1 m = 2 hi = 71 65 65 M = 2 m = 3 hi = 65 65 71 M = 3 m = 4 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 4 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 4 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 4 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 3 hi = 65 71 71 M = 4 m = 2 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4 m = 1 hi = 65 71 71 M = 4

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

M = 0 m = 1 hi = 73 110 M = 1 m = 3 hi = 110 32 M = 3 m = 1 hi = 110 32 M = 3 m = 1 hi = 110 32 M = 3 m = 1 hi = 110 32 M = 3 m = 2 hi = 110 32 M = 3 m = 1 hi = 110 32 M = 3 m = 1 hi = 110 32 M = 3 m = 4 hi = 44 32 M = 4 m = 1 hi = 44 32 M = 4 m = 2 hi = 44 32 M = 4 m = 3 hi = 44 32 M = 4 m = 4 hi = 44 32 M = 4 m = 2 hi = 44 32 M = 4 m = 1 hi = 44 32 M = 4 m = 1 hi = 44 32 M = 4 m = 1 hi = 44 32 M = 4 m = 5 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 3 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 5 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 3 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 5 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 4 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 5 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 3 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 5 hi = 101 114 M = 5 m = 2 hi = 101 114 M = 5 m = 3 hi = 101 114 M = 5 m = 1 hi = 101 114 M = 5