You need to sign in or sign up before continuing.×
Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
noice
dang jeff
As was mentioned above, try using some datastructure that has something like a hash table for lookups of possible solutions. Something like a dictionary in Python, an associative array in PHP, a map in Elixir, etc.
I think it really depends on your philosophy. Elixir doesn't have many idioms or strong suggestions as to how to go about a problem, so you see different approaches. For some, code being easy to reason about is more important than efficiency. I personally adhere to two things above efficiency:
Other than that, I really appreciate this different take on the solution!
Edit: I also like that this solution directly solves the problem and only the problem. Very nice.
Very clean! You could also just use Stream.dedup here instead of uniq for slightly less overhead since the ones will be next to each other.
Wow. I've got a lot to learn.
I knew something like this was possible and just couldn't sort it out. Thank you!
Other solutions don't have to have separate cases for even and odd by basing the middle off of the division. That's smart and something I've learned now!
This comment is hidden because it contains spoiler information about the solution
noice, much better than my ham-fisted attempt!