Cody

Problem 79. DNA N-Gram Distribution

Solution 1754591

Submitted on 19 Mar 2019 by Zain Faruqi
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))

g = [] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In nGramFrequency (line 3) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] h = 9×3 char array 'AAC' 'ACT' 'CTG' 'TGA' 'GAA' 'AAC' 'ACG' 'CGT' 'GTG' d = "AAC" g = "AAC" d = "ACT" g = 1×2 string array "AAC" "ACT" d = "CTG" g = 1×3 string array "AAC" "ACT" "CTG" d = "TGA" g = 1×4 string array "AAC" "ACT" "CTG" "TGA" d = "GAA" g = 1×5 string array "AAC" "ACT" "CTG" "TGA" "GAA" d = "AAC" g = 1×6 string array "AAC" "ACT" "CTG" "TGA" "GAA" "AAC" d = "ACG" g = 1×7 string array "AAC" "ACT" "CTG" "TGA" "GAA" "AAC" "ACG" d = "CGT" g = 1×8 string array "AAC" "ACT" "CTG" "TGA" "GAA" "AAC" "ACG" "CGT" d = "GTG" g = 1×9 string array "AAC" "ACT" "CTG" "TGA" "GAA" "AAC" "ACG" "CGT" "GTG" s1 = 0×0 empty char array s1 = "AAC" s1 = "AAC" hifreq = 'AAC'

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

g = [] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In nGramFrequency (line 3) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] h = 23×2 char array 'dy' 'yn' 'na' 'am' 'mi' 'ic' 'c ' ' r' 'ro' 'ou' 'ut' 'ti' 'in' 'ng' 'g ' ' s' 'se' 'er' 'rv' 'vi' 'ic' 'ce' 'en' d = "dy" g = "dy" d = "yn" g = 1×2 string array "dy" "yn" d = "na" g = 1×3 string array "dy" "yn" "na" d = "am" g = 1×4 string array "dy" "yn" "na" "am" d = "mi" g = 1×5 string array "dy" "yn" "na" "am" "mi" d = "ic" g = 1×6 string array "dy" "yn" "na" "am" "mi" "ic" d = "c " g = 1×7 string array "dy" "yn" "na" "am" "mi" "ic" "c " d = " r" g = 1×8 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" d = "ro" g = 1×9 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" d = "ou" g = 1×10 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" d = "ut" g = 1×11 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" d = "ti" g = 1×12 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" d = "in" g = 1×13 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" d = "ng" g = 1×14 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" d = "g " g = 1×15 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " d = " s" g = 1×16 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" d = "se" g = 1×17 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" "se" d = "er" g = 1×18 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" "se" "er" d = "rv" g = 1×19 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" "se" "er" "rv" d = "vi" g = 1×20 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" "se" "er" "rv" "vi" d = "ic" g = 1×21 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" "se" "er" "rv" "vi" "ic" d = "ce" g = 1×22 string array "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" "se" "er" "rv" "vi" "ic" "ce" d = "en" g = 1×23 string array Columns 1 through 22 "dy" "yn" "na" "am" "mi" "ic" "c " " r" "ro" "ou" "ut" "ti" "in" "ng" "g " " s" "se" "er" "rv" "vi" "ic" "ce" Column 23 "en" s1 = 0×0 empty char array s1 = "dy" s1 = "ic" hifreq = 'ic'

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