29 ms·
Further spoiler: I replaced "one" with "o1e", "two" with "t2o", etc. which is hacky as hell, but works for throwaway contest code. (Replacing as suggested above
by sokoloff 3y ago
Further spoiler: I replaced "one" with "o1e", "two" with "t2o", etc. which is hacky as hell, but works for throwaway contest code. (Replacing as suggested above also works, but is more typing.)
That let me keep the problem in the filter/map/first-last/reduce space, which was the shape of my solution to part 1.
- rileymichael 3y agoThat’s exactly what I pivoted to once I realized my naive replace wouldn’t work. That sort of moment is what makes AoC feel so rewarding in my opinion. impl fully showing the trick: https://github.com/rileymichael/aoc-2023/blob/master/src/main/kotlin/day1/Day1.kt https://github.com/rileymichael/aoc-2023/blob/master/src/mai...
- Maxion 3y agoI have to say that this is a hacky approach but I love it!