Fix 2018/2/2 solution
This commit is contained in:
parent
1968911351
commit
30fad2d678
1 changed files with 3 additions and 3 deletions
|
@ -14,9 +14,9 @@ object Day02 extends Day {
|
|||
|
||||
override def part2(input: String): String = {
|
||||
val lines = input.lines.toList
|
||||
val distanceMap = lines.flatMap(s => lines.map(c => ((s, c), levenshtein(s, c)))).toMap
|
||||
val ((s, c), _) = distanceMap.filter {case (_, d) => d > 0 }.minBy { case (_, d) => d }
|
||||
s.intersect(c).mkString
|
||||
val distanceMap = lines.flatMap(s => lines.map(c => ((s, c), s.intersect(c)))).toMap
|
||||
val (_, r) = distanceMap.filter { case ((a, _), d) => d.length != a.length }.maxBy { case (_, d) => d.length }
|
||||
r.mkString
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue