This may have been the simplest problem so far. For a while, I was checking the wrong stopping condition, so it took me longer than it should have.
Reduce is my go-to construct for processing a list of things. You can cram as many things into the accumulator as you need to. There are probably other enumerable operations that would do a better job, but reduce is the one-size-fits-all tool that I always reach for.
Top comments (0)