Cody

# Problem 79. DNA N-Gram Distribution

Solution 416177

Submitted on 10 Mar 2014 by Zikobrelli
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))

S = AAC ACT CTG TGA GAA AAC ACG ans = AAC

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

S = dy yn na am mi ic c r ro ou ut ti in ng g s se er rv vi ic ce ans = ic

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

S = Your our v ur ve r ver vera verac eraci racit acity city ity i ty is y is is e is ex s exc exce excee xceed ceede eeded eded ded b ed by d by by y by yo y you your your our s ur sa r sag saga sagac agaci gacit acity city. ans = acity

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

S = AGC GCG CGA GAA AAG AGG GGA GAA AAG AGG GGA GAT ATC TCA CAC ACA CAT ATT TTT TTC TCT CTC TCA CAG AGG GGA GAC ACA CAA AAA AAG AGG GGC GCA CAT ATT TTT TTC TCA CAC ACT CTA TAA AAT ATG TGG GGT GTT ans = AGG

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

S = In n s sh ho or rt t, , i in n m ma at tt te er rs s v ve eg ge et ta ab bl le e, , a an ni im ma al l, , a an nd d m mi in ne er ra al l, , I I a am m t th he e v ve er ry y m mo od de el l o of f a a m mo od de er rn n M Ma aj jo or r- -G Ge en ne er ra al l. ans = er