diff options
-rw-r--r-- | 3.py | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -28,9 +28,7 @@ def part1(nums: Input) -> int: def part2_impl(nums: Input, complement: bool, bit: int = 0) -> Bits: if len(nums) == 1: return nums[0] - target: bool = most_common(column(nums, bit)) - if complement: - target = not target + target: bool = most_common(column(nums, bit)) ^ complement nums = list(filter(lambda n: n[bit] == target, nums)) return part2_impl(nums, complement, bit + 1) |