Created
July 22, 2015 19:04
-
-
Save goral09/d6b014b5c937bc7e9a05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hiddenMsg(kmer: Int, msg: String) = { | |
msg.sliding(kmer).foldLeft[Map[String, Int]](Map.empty) { case (acc, curr) => | |
if (acc.isDefinedAt(curr)) acc.updated(curr, acc(curr) + 1) | |
else acc.updated(curr, 1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment