summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--3.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/3.py b/3.py
index fdfe203..7750fa1 100644
--- a/3.py
+++ b/3.py
@@ -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])