From b6f7a57580126087b19354c4d4f60b8af76267a7 Mon Sep 17 00:00:00 2001 From: David Ashby Date: Fri, 3 Dec 2021 19:00:32 -0500 Subject: [PATCH] clean up the increment logic at the bottom --- 03/main.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/03/main.go b/03/main.go index e183b42..b551bcc 100644 --- a/03/main.go +++ b/03/main.go @@ -100,11 +100,7 @@ func partTwo() { if oxOnes >= oxZeroes { oxgen += (1 << (i - 1)) } - if coZeroes == 0 && coOnes != 0 { - co2scrub += (1 << (i - 1)) - } else if coZeroes != 0 && coOnes == 0 { - co2scrub += (0 << (i - 1)) - } else if coOnes < coZeroes { + if (coZeroes == 0 && coOnes != 0) || (coOnes < coZeroes && coOnes != 0) { co2scrub += (1 << (i - 1)) } }