Browse Source

Adding docstring for commonality

pull/3/head
Ryan Reed 3 years ago
parent
commit
8e208459d2
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      puzzles/day03.py

+ 14
- 1
puzzles/day03.py View File

@ -88,7 +88,20 @@ class Diagnostics:
return oxygen_generator_rating * co2_scrubber_rating
@staticmethod
def commonality(report: List[int]) -> List[Dict[str, int]]:
def commonality(report: List[int]) -> List[int]:
"""
Return the most common value in each column of binary numbers
Args:
report: List of binary numbers
Returns:
List containing the most common value in the column
Possible Values:
0
1
2 - This indicates equally common
"""
num_1 = defaultdict(int)
for binary in report:
for column, bit in enumerate(binary):


Loading…
Cancel
Save