Created
December 6, 2016 08:10
-
-
Save pakaufmann/32a58cea54c72a6ad1df7d7acd9302ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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