diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2021-12-03 10:55:52 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2021-12-03 10:55:52 +0000 |
commit | d2d7ede396c4349db45615f05a11c38540a4040c (patch) | |
tree | 9453cd1e616f68928764870af437af23afa3536f | |
parent | c45449b1a1cd0eee0c481e1a4f784686e44bb49d (diff) | |
download | aoc2021-d2d7ede396c4349db45615f05a11c38540a4040c.tar.gz aoc2021-d2d7ede396c4349db45615f05a11c38540a4040c.tar.xz aoc2021-d2d7ede396c4349db45615f05a11c38540a4040c.zip |
day 3 part 2: minor bugfix
-rw-r--r-- | 3.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -11,7 +11,7 @@ def column(rows: Iterable[Bits], n: int) -> Generator[bool, None, None]: def most_common(bits: Iterable[bool]) -> bool: freqs: list[tuple[bool, int]] = Counter(bits).most_common() - if freqs[0][1] == freqs[1][1]: + if len(freqs) > 1 and freqs[0][1] == freqs[1][1]: return True return freqs[0][0] |