|
|
|
|
|
by messe
934 days ago
|
|
Yeah, all the talk of replacement seems like people masively overthinking or abstracting a day one problem. My C++ solution was a simple search using the <algorithm> header. It's a little less neatly abstracted out as yours, and could be cleaned up a fair bit, as I wasn't bothered to deduplicate the code after getting it working (and I will if this turns out to be useful tomorrow), but the essence is the same: https://gist.github.com/joedavis/3d6f2b87bae4809ef8a062caff7... C++'s .rbegin() / .rend() reverse iterators made the search fairly trivial. |
|
My solution in Kotlin https://github.com/kolonialno/adventofcode/commit/686cbebb07...