Skip to main content

2021 - Day 3

🎄 Advent of Code in Zef 🎄​

https://adventofcode.com/2021/day/3

data = """  
00100
11110
10110
10111
10101
01111
00111
11100
10000
11001
00010
01010
"""

x = (data
| split['\n']
| trim['']
| map[map[int]]
| transpose
| map[mean]
| map[greater_than[0.5]]
| collect
)


to_num = (reverse
| enumerate
| filter[second]
| map[first]
| map[lambda n: 2**n]
| sum
| collect
)

result = (x | to_num)*(x | map[Not] | to_num)