Move Python solutions
This commit is contained in:
parent
6fae773051
commit
2f1872bbd9
255 changed files with 0 additions and 4323 deletions
15
Python/2022/04.py
Normal file
15
Python/2022/04.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from utils.parsing import pints
|
||||
|
||||
|
||||
def part1(puzzle: str):
|
||||
return sum(a <= c <= d <= b or c <= a <= b <= d for a, b, c, d in map(pints, puzzle.splitlines()))
|
||||
|
||||
|
||||
def part2(puzzle: str):
|
||||
return sum(d >= a and c <= b for a, b, c, d in map(pints, puzzle.splitlines()))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from aoc import run
|
||||
|
||||
run(2022, 4, part1, part2)
|
Loading…
Add table
Add a link
Reference in a new issue