From bcb7d535a4c70c53a1c2b8689fdf35263b8d336d Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 1 Dec 2020 21:45:41 -0800 Subject: [PATCH] Use xor in part 2 of day 2. --- day2.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/day2.cr b/day2.cr index 5020481..f411574 100644 --- a/day2.cr +++ b/day2.cr @@ -30,7 +30,7 @@ def part2 min, max, char, str = data min -= 1 max -= 1 - ((str[min] == char) || (str[max] == char) ) && str[min] != str[max] + (str[min] == char) ^ (str[max] == char) end puts total