-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c57350
commit 3661ba7
Showing
6 changed files
with
1,578 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
splitlines = ([elf.split('-') for elf in line.strip().split(',')] | ||
for line in open("2022_4_cleanup_input.txt")) | ||
total_overlaps = 0 | ||
overlaps = 0 | ||
for elf_a, elf_b in splitlines: | ||
set_a = set(range(int(elf_a[0]), int(elf_a[1])+1)) | ||
set_b = set(range(int(elf_b[0]), int(elf_b[1])+1)) | ||
#print(set_a, set_b) | ||
if set_a <= set_b or set_b <= set_a: | ||
total_overlaps += 1 | ||
if set_a & set_b: | ||
overlaps += 1 | ||
print(total_overlaps) | ||
print(overlaps) |
Oops, something went wrong.