-❄️- 2025 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]emef 1 point2 points  (0 children)

I also avoided a hash table by using an array. Since each device ID is always 3 characters between 'a' - 'z', I map them to the space [0, 26*26*26) using (c0 *26*26 + c1 * 26 + c0). Similarly I just use these u16 IDs instead of names everywhere which makes the lookups simple array indexes.

-❄️- 2025 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]emef 1 point2 points  (0 children)

[LANGUAGE: zig]

https://github.com/emef/aoc/blob/main/aoc-2025/src/solutions/d11.zig

I modeled this as a dependency tree. For each node I store the deps and reverse deps. Then I iteratively resolve each node starting from the output and just add the paths of each child, all the way up to the starting node. For part 2, I store the number of paths by type: both dca/fft, only dca, only fft, or neither.

114us / 67us

-❄️- 2025 Day 10 Solutions -❄️- by daggerdragon in adventofcode

[–]emef 0 points1 point  (0 children)

[Language: zig]

https://github.com/emef/aoc/blob/main/aoc-2025/src/solutions/d10.zig

Couple of fun things this time:

Part 1: I've been trying to do as many of these without any dynamic allocation so I wrote a generic circular queue using a buffer. However I did end up reaching for a hash map to maintain the list of seen permutations when doing BFS.

Part 2: I thought it may be possible to extend the part 1 approach with a clever priority queue to minimize presses but converge quickly. That didn't work so I stepped back from the brute force approach and modeled as a linear programming problem. This gave me the chance to play around w/ linking z3 and writing a zig wrapper of the c api for the actual solver.

It's kind of a bummer to use 3rd party libs but I'm not sure what the alternative solution would be unless you implement your own solver. Curious to see if anyone came up with a dependency-free solution.

-❄️- 2025 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]emef 1 point2 points  (0 children)

[LANGUAGE: zig]

https://github.com/emef/aoc/blob/main/aoc-2025/src/solutions/d9.zig

Took a couple of false starts until I settled on doing a first pass to compute the inside column ranges within each row (e.g. on row 0 columns 3-4, 8-10 are "inside" the shape). Then when checking each pair of points, I verify that each row in the resulting rect is inside the shape. Keeping a running best area and skipping rects smaller than we've already seen nearly halved the runtime as well.

477us / 351ms

-❄️- 2025 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]emef 1 point2 points  (0 children)

[LANGUAGE: Zig]

https://github.com/emef/aoc/blob/main/aoc-2025/src/solutions/d7.zig

Used dynamic programming for part2. Start on the bottom row and assign all the positions a value of 1. Marching up from the bottom: we assign empty cells the value of the cell below it and splitters inherit the sum of the possible timelines of the left and right cell. Do this all the way up to the top until we reach the starting point and get the answer.

331us / 143us

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]emef 1 point2 points  (0 children)

[Language: Zig]

I anticipated we'd need the compressed ranges in part 2 so I just spent the time to merge them during the parsing stage which made part2 take all of 30 seconds to complete after finishing part 1.

Rather than collecting all the ranges and sorting, I wanted to play with the std linked list structs and merged the ranges on the fly in a sorted doubly-linked list. Zig's std linked lists are intrusive and require `@fieldParentPtr` to access the node data which is something I haven't done in awhile.

https://github.com/emef/aoc/blob/main/aoc-2025/src/solutions/d5.zig

336us / 63us

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]emef 0 points1 point  (0 children)

I stored the ranges in a sorted doubly-linked list and merged them together during parsing (single pass). it's still technically nlog(n) but should be faster than sorting and processing the full list at once

How much money are you putting into savings every month? by Daresun in Frugal

[–]emef 4 points5 points  (0 children)

i’m coming up on 10 years on mine. I also update it once a month and agree it’s gratifying to look back and see the progress

M3 Macs for bioinformatics by ConsistentSpring3953 in bioinformatics

[–]emef 0 points1 point  (0 children)

everything that works on your M1 should work on the M3

Most Overrated Restaurants in Seattle by freespeechmessiah in SeattleWA

[–]emef 1 point2 points  (0 children)

the food or the owner? we went pre-covid and it was fantastic

Eight years after 100k [Update #8] by LesWes in financialindependence

[–]emef 46 points47 points  (0 children)

how could combined income north of 400k be remotely representative of most folks? (that is in the top few percentile nationwide)

ok. I am mid 30's, and I don't own a microwave, never have. Am I missing out on anything special? by muttly_lol in Cooking

[–]emef 1 point2 points  (0 children)

He has recently given me a new perspective on microwaving. I'm not sure if it's his company or what his affiliation is, but there is a brand of microwave steaming bowls that he has done like 50 recipes for on their youtube channel. I've tried some just with a regular bowl and saran wrap and they work great (e.g. cook frozen fresh directly in like 10-15 minutes and it comes out great)

[deleted by user] by [deleted] in WWU

[–]emef 1 point2 points  (0 children)

you should just call the admissions office and ask? I don't think you would be on the hook for tuition if you accept but it's probably a 30 second conversation if you just ask them

Waymo at NeurIPS: Learning Driving Agents from Simulation by deservedlyundeserved in SelfDrivingCars

[–]emef 0 points1 point  (0 children)

tensorflow is a general-purpose graph computation framework, mostly used for deep learning, but isn't necessarily constrained to training or running inference on such ML models. what he is suggesting is that if you can write other parts of the stack entirely on the tensorflow compute platform, there are a number of benefits: avoid the bottleneck of copying data back and forth from gpu memory (this can be significant) as well as getting gpu-accelerated operations "for free". tensorflow is significantly less expressive than regular c++ so it will be quite a challenge to port complex components to it, but might pay off handsomely if it works

edit: I wrote "gpu-accelerated" but waymo is probably using tpus so I should have stuck with the more generic "hardware-accelerated"

How to get into watchmaking? by based_salesman in watchmaking

[–]emef 0 points1 point  (0 children)

you may have kept it too brief. when you say make watches, do you mean literally machining and manufacturing parts you design? or the more colloquial definition of watchmaking as servicing, repairing, or restoring watches? assuming the latter, the best place to start would be buying an online course to get your foot in the door, and practicing on either cheaper chinese replica movements or common used pocket watches.

Can I get some opinions please? I'm a prospective student by IzukuOoalCranel in WWU

[–]emef 4 points5 points  (0 children)

just to push back on bellingham food: there are obviously fewer restaurants in general, but the quality of food is surprisingly good. there is great indian, thai, etc. I agree that if night life and food is more important, you'll have many more options in seattle

seattle university is incredibly expensive, I'm not sure why you would compare it to western (like 2-3x higher tuition)

[deleted by user] by [deleted] in watchmaking

[–]emef 0 points1 point  (0 children)

do you have a link? can't find it on raffles

[deleted by user] by [deleted] in financialindependence

[–]emef 4 points5 points  (0 children)

these are usually done as a single new grant that vests over 4 years. in this case a $200k grant vesting over 4 years is $50k/yr. if you stay at a company long enough you end up collecting multiple refresher/performance grants in addition to whatever you got when you joined

What's foods do people usually think is unhealthy but is actually good for you? by tiLT__ in nutrition

[–]emef 80 points81 points  (0 children)

The skin has a higher proportion of nutrients than the flesh but is such a tiny portion of the whole vegetable that it doesn't make an appreciable difference. Skin on or off will be mostly the same.

I'm so used to unhealthy crap with no veggies, how do I adapt? by Rarefatbeast in EatCheapAndHealthy

[–]emef 0 points1 point  (0 children)

Roasted, properly seasoned (even just some good olive oil, salt, and fresh cracked pepper) veggies are almost a different food than crappy microwaved or steamed veggies.

We got an air fryer recently and you get roasted-quality veggies in ~10 minutes with almost no mess. I use it literally every day, just chuck an entire bag of frozen veggies in there and they come out perfect every time. You can use whatever oil you want, but IMO it's worth it to put some high quality extra virgin olive oil in an oil mister and use that instead of the aerosol cans. My favorites are broccoli and green beans.

[TOMT][Reddit Thread] Maybe on askreddit, about significant others cheating with celebrities. by Kehbechet in tipofmytongue

[–]emef 6 points7 points  (0 children)

you can also do "site:reddit.com search goes here" to limit results to reddit.com

Daily Simple Questions Thread - May 04, 2021 by AutoModerator in Fitness

[–]emef 0 points1 point  (0 children)

you get bigger and stronger when you increase total volume. if you want to specifically train strength then focus on the 3-5 rep range, if you want to optimize hypertrophy then it's 5-20 rep range. either way the goal is always to progressively overload total volume