Generate the Frequency Array of a String solved by 279

July 29, 2015, 1:08 a.m. by Rosalind Team

Figure 1. A frequency array.

Given an integer k, we define the frequency array of a string Text as an array of length 4k, where the i-th element of the array holds the number of times that the i-th k-mer (in the lexicographic order) appears in Text (see Figure 1.

Computing a Frequency Array

Generate the frequency array of a DNA string.

Given: A DNA string Text and an integer k.

Return: The frequency array of k-mers in Text.

Sample Dataset

ACGCGGCTCTGAAA
2

Sample Output

2 1 0 0 0 0 2 2 1 2 1 0 0 1 1 0

Extra Datasets

Please login to solve this problem.