8000 Simplify 2018 day 5 opposites definition · sim642/adventofcode@9b79897 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b79897

Browse files
committed
Simplify 2018 day 5 opposites definition
1 parent 4a8dc3f commit 9b79897

File tree

1 file changed

+1
-4
lines changed
  • src/main/scala/eu/sim642/adventofcode2018

1 file changed

+1
-4
lines changed

src/main/scala/eu/sim642/adventofcode2018/Day5.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ package eu.sim642.adventofcode2018
22

33
object Day5 {
44

5-
def opposites(a: Char, b: Char): Boolean = (a.isLower, b.isLower) match {
6-
case (true, false) | (false, true) => a.toLower == b.toLower
7-
case _ => false
8-
}
5+
def opposites(a: Char, b: Char): Boolean = a != b && a.toLower == b.toLower
96

107
def reactPolymer(s: String): String = {
118
/*def helper(init: List[Char], tail: List[Char]): List[Char] = (init, tail) match {

0 commit comments

Comments
 (0)
0