Cody

# Problem 79. DNA N-Gram Distribution

Solution 449190

Submitted on 3 Jun 2014 by Abdullah Caliskan
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))

hh = 1 0 0 0 0 1 G = AAC H = 2 hh = 0 1 0 0 0 0 G = AAC ACT H = 2 1 hh = 0 0 1 0 0 0 G = AAC ACT CTG H = 2 1 1 hh = 0 0 0 1 0 0 G = AAC ACT CTG TGA H = 2 1 1 1 hh = 0 0 0 0 1 0 G = AAC ACT CTG TGA GAA H = 2 1 1 1 1 hh = 1 0 0 0 0 1 G = AAC ACT CTG TGA GAA AAC H = 2 1 1 1 1 2 rr = 2 pp = 1

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

hh = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = dy H = 1 hh = 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = dy yn H = 1 1 hh = 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = dy yn na H = 1 1 1 hh = 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = dy yn na am H = 1 1 1 1 hh = 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = dy yn na am mi H = 1 1 1 1 1 hh = 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 G = dy yn na am mi ic H = 1 1 1 1 1 2 hh = 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = dy yn na am mi ic c H = 1 1 1 1 1 2 1 hh = 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 G = dy yn na am mi ic c r H = 1 1 1 1 1 2 1 1 hh = 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 G = dy yn na am mi ic c r ro H = 1 1 1 1 1 2 1 1 1 hh = 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 G = dy yn na am mi ic c r ro ou H = 1 1 1 1 1 2 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 G = dy yn na am mi ic c r ro ou ut H = 1 1 1 1 1 2 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 G = dy yn na am mi ic c r ro ou ut ti H = 1 1 1 1 1 2 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 G = dy yn na am mi ic c r ro ou ut ti in H = 1 1 1 1 1 2 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 G = dy yn na am mi ic c r ro ou ut ti in ng H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 G = dy yn na am mi ic c r ro ou ut ti in ng g H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 G = dy yn na am mi ic c r ro ou ut ti in ng g s H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 G = dy yn na am mi ic c r ro ou ut ti in ng g s se H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 G = dy yn na am mi ic c r ro ou ut ti in ng g s se er H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 G = dy yn na am mi ic c r ro ou ut ti in ng g s se er rv H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 G = dy yn na am mi ic c r ro ou ut ti in ng g s se er rv vi H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 G = dy yn na am mi ic c r ro ou ut ti in ng g s se er rv vi ic H = 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 rr = 2 pp = 6

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

hh = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your H = 1 hh = 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v H = 1 1 hh = 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve H = 1 1 1 hh = 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver H = 1 1 1 1 hh = 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera H = 1 1 1 1 1 hh = 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac H = 1 1 1 1 1 1 hh = 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci H = 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci racit H = 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 G = Your our v ur ve r ver vera verac eraci racit acity H = 1 1 1 1 1 1 1 1 2 hh = 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci racit acity city H = 1 1 1 1 1 1 1 1 2 1 hh = 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci racit acity city ity i H = 1 1 1 1 1 1 1 1 2 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci racit acity city ity i ty is H = 1 1 1 1 1 1 1 1 2 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci racit acity city ity i ty is y is H = 1 1 1 1 1 1 1 1 2 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci racit acity city ity i ty is y is is e H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = Your our v ur ve r ver vera verac eraci racit acity city ity i ty is y is is e is ex H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 G = 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 H = 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 hh = 0 0 0 0 0 ...

4   Fail