Skip to content

Instantly share code, notes, and snippets.

@pakaufmann
Created December 6, 2016 08:10
Show Gist options
  • Save pakaufmann/32a58cea54c72a6ad1df7d7acd9302ea to your computer and use it in GitHub Desktop.
Save pakaufmann/32a58cea54c72a6ad1df7d7acd9302ea to your computer and use it in GitHub Desktop.
object Day6 extends Challenge {
val lines = loadFile("day6.txt").getLines().toList.transpose.map(groupByChars)
override def runFirst(): Unit = {
println(lines.map(_.maxBy(_._2)._1).mkString)
}
override def runSecond(): Unit = {
println(lines.map(_.minBy(_._2)._1).mkString)
}
def groupByChars(list: List[Char]) = list.groupBy(identity).mapValues(_.size)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment