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.
Please note that your solution has a very bad performance, hence I'm not upvoting it for best practices or clever. The ++ operater is VERY expensive in Elixir, please compare your result with mine to see how list prepending can tremendously increase your performance.
Just to illustrate how not performant this is, here are several examples:
This illustrates that with big data, time spent upon your function is a lot longer. Hopefully people will read this comment and realize that performance is definitely something to keep in mind! :)
As for the code to measure this:
Beware of big numbers, tail-call optimization is not used here! For more information about Elixir tail-call optimization, read the official docs regarding recursion https://elixir-lang.org/getting-started/recursion.html where (at the moment of writing) is a link to the wikipedia "tail-call" page.
Beware of big numbers, tail-call optimization is not used here! For more information about Elixir tail-call optimization, read the official docs regarding recursion https://elixir-lang.org/getting-started/recursion.html where (at the moment of writing) is a link to the wikipedia "tail-call" page.