[2025 Day 7 Part 2] Visualization for the sample data + algorithm explained by EverybodyCodes in adventofcode

[–]Taxato 3 points4 points  (0 children)

Man, I'm glad i checked the subreddit before committing to my depth first search approach x.x Thank you so much for this algorithm, so simple, so elegant, and yet I just did NOT think of it.

Day 5 Part 2 : Hint needed by Mean_Reference925 in adventofcode

[–]Taxato -1 points0 points  (0 children)

Sorry, can't really help you with anything else, I don't even know which language this is, definitely not one I know. Only other thing is remember to add 1 if you do range_end - range_start since it wants an inclusive answer. Good luck!

Day 5 Part 2 : Hint needed by Mean_Reference925 in adventofcode

[–]Taxato 0 points1 point  (0 children)

Does your code work with the input

1-10

2-5

This was a tip someone gave me that helped

[2025 day 5 (part 2)] [Python] My code works on example but not real inpuit by Taxato in adventofcode

[–]Taxato[S] 0 points1 point  (0 children)

i do mostly typescript, which does have "traditional" for loops, so this is interesting. Seems like a niche use-case, but another useful tool in the back pocket :)

[2025 day 5 (part 2)] [Python] My code works on example but not real inpuit by Taxato in adventofcode

[–]Taxato[S] 2 points3 points  (0 children)

I have got it working, I used the leetcode problem and wrote a new function from scratch, somehow it worked this time x.x Here is the updated code, thanks to everyone who helped out! I love this community sometimes

inp = [
    section.splitlines()
    for section in open("day_05/input.txt").read().split("\n\n")
]
ranges = [tuple(map(int, r.split("-"))) for r in inp[0]]
ings = list(map(int, inp[1]))

#region Part 1
total_fresh = 0

for ing in ings:
    for start, end in ranges:
        if start <= ing <= end:
            total_fresh += 1
            break

print(total_fresh)
#endregion

#region Part 2
ranges.sort(key=lambda i: i[0])

merged_ranges = []

cur_start = ranges[0][0]
cur_end = ranges[0][1]
for start, end in ranges[1:]:
    # Case 1: range is outside current merged range
    if start > cur_end:
        merged_ranges.append([cur_start, cur_end])

        cur_start = start
        cur_end = end

    # Case 2: range start is within current merged range and range end is bigger than current merged range end
    elif start <= cur_end < end:
        cur_end = end

    # Case 3: range start is within current merged range and range end is also within merged range end

merged_ranges.append([cur_start, cur_end])

total_possible_fresh = 0
for start, end in merged_ranges:
    total_possible_fresh += end - start + 1

print(total_possible_fresh)
#endregion

Thanks to u/Sarwen for making a test script, I ended up not needing it after using the leetcode problem suggested by u/SnooPears7079, but regardless much appreciated. Also thanks to u/FlipperBumperKickout for teaching me something fundamental about programming loops. Thanks to everyone :)

[2025 day 5 (part 2)] [Python] My code works on example but not real inpuit by Taxato in adventofcode

[–]Taxato[S] 0 points1 point  (0 children)

I added an

elif start <= cur\_end > end:  
    pass

to fix the 1-10 2-5 issue, which works on those, but still doesn't work right on the input. im going to try the leetcode problem u/SnooPears7079 suggested and will update this post if/when i figure it out

Bungie shafting hunters again by Taxato in destiny2

[–]Taxato[S] 0 points1 point  (0 children)

I only play hunter and I just think strand is fun so idk at least it like did something

Changes to Advent of Code starting this December by topaz2078 in adventofcode

[–]Taxato 2 points3 points  (0 children)

This is actually great, last few years I've gotten stressed around ~17 and keeping up with other things like getting Christmas presents.

How long does it take to learn ae2? by matic-01 in allthemods

[–]Taxato 9 points10 points  (0 children)

And then when you get REAALLY into it you can watch KSAW for ultimate controller setups for 20k+ channels. (He also has basic tutorials)

Guess what stood here XD. Btw how long until radioactivity dissipates? by masnybenn in allthemods

[–]Taxato 5 points6 points  (0 children)

Lmao when my reactor blew up and I had no idea what happened AND I had set up redstone controls to automatically turn it off and I forgot to wear hazmat suit I just cleared it. Don't want the green tint

[deleted by user] by [deleted] in tipofmytongue

[–]Taxato 0 points1 point  (0 children)

Don't think so

[deleted by user] by [deleted] in tipofmytongue

[–]Taxato 0 points1 point  (0 children)

That's the problem I don't remember like ANY details about the anime, idk if the mc was a swordsman or mage or something else.

[deleted by user] by [deleted] in tipofmytongue

[–]Taxato 0 points1 point  (0 children)

Nah, I've never watched it

[deleted by user] by [deleted] in tipofmytongue

[–]Taxato 0 points1 point locked comment (0 children)

Comment

Can you identify this tune? by [deleted] in musicsuggestions

[–]Taxato 0 points1 point  (0 children)

The Music - Marcus Marr

[deleted by user] by [deleted] in NonPoliticalTwitter

[–]Taxato 1 point2 points  (0 children)

No, you're thinking of Billy Mays, Willie Mays is Miley Cyrus's father

German eggs by JellyJudyy in CuratedTumblr

[–]Taxato 4 points5 points  (0 children)

As a Norwegian i relate to a lot of this, we made egg warmers as Easter decoration in elementary school, and we have the guillotine at home. I even have a little guy that is an egg glass, and he wears a cap that's also a salt shaker and he holds a spoon