Compare commits

..

No commits in common. "e190b4dd3bd34d50993c6f91409023cae687f194" and "789f2f89e6c863249cdffca1373a45720e7f2d56" have entirely different histories.

4 changed files with 0 additions and 2048 deletions

View file

@ -1,24 +0,0 @@
#!/usr/bin/env python
import sys
def solve(input: list[str]) -> int:
def is_redundant(line: str) -> bool:
def assignment_to_set(elf: str) -> set[int]:
start, end = elf.split("-")
return set(range(int(start), int(end) + 1))
elf1, elf2 = map(assignment_to_set, line.split(","))
return elf1.issubset(elf2) or elf2.issubset(elf1)
return sum(map(is_redundant, input))
def main() -> None:
input = sys.stdin.read().splitlines()
print(solve(input))
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load diff

View file

@ -1,24 +0,0 @@
#!/usr/bin/env python
import sys
def solve(input: list[str]) -> int:
def is_overlapping(line: str) -> bool:
def assignment_to_set(elf: str) -> set[int]:
start, end = elf.split("-")
return set(range(int(start), int(end) + 1))
elf1, elf2 = map(assignment_to_set, line.split(","))
return bool(elf1 & elf2)
return sum(map(is_overlapping, input))
def main() -> None:
input = sys.stdin.read().splitlines()
print(solve(input))
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load diff