diff options
-rw-r--r-- | 3.py | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -17,11 +17,7 @@ def most_common(bits: Iterable[bool]) -> bool: return count1 >= length - count1 def bits_to_int(bits: Bits) -> int: - ret: int = 0 - for i, b in enumerate(reversed(bits)): - if b: - ret += 2 ** i - return ret + return sum(b * 2 ** i for i, b in enumerate(reversed(bits))) def part1(nums: Input) -> int: nbits: int = len(nums[0]) |