We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 31b0567 commit c5bdabcCopy full SHA for c5bdabc
aoc/2025/05/05.vn.py
@@ -21,25 +21,24 @@
21
)
22
23
24
-res1 = 0
25
-for ingredient in ingredients:
26
- for l, r in ranges:
27
- if l <= ingredient and ingredient <= r:
28
- res1 += 1
29
- break
30
-
31
32
ranges = sorted(ranges)
33
for i in range(len(ranges) -1):
34
l, r = ranges[i]
35
l1, r1 = ranges[i + 1]
36
if r >= l1:
37
ranges[i + 1] = (l, max(r, r1))
38
ranges[i] = (0, -1)
39
- # I should remove them but saying nothing
40
- # is in is enough
41
+ # I should remove it but saying
+ # it is empty is enough
+
42
# They're all independant now
+res1 = 0
+for ingredient in ingredients:
+ for l, r in ranges:
+ if l <= ingredient and ingredient <= r:
+ res1 += 1
43
res2 = 0
44
for l, r in ranges:
45
res2 += r - l + 1
0 commit comments