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.
Clever
Nice :)
Yeah, this needs memoization. Lots of repeated calculations. Super inefficient.
Coming to see other solutions after solving a kata is one of my favorite moments because of things like this, I always learn something new.
Why recursive lambda?
It is generaly not a good practice to try to make the code as short as possible but to make it as readable as possible...
For example if you look at my solution, it is basicaly the same as yours but a lot more readable.
(Just a tip :))
I'm surprised this didn't time out
incredible solution you wrote!
Not straightforward, but smart!
to truncate to 6 decimal places
can one explain how the main formula (1 / n!) * (1! + 2! + 3! + ... + n!) been simplified to the above solution (in a simple for loop). Also please recommend me where I can learn the tricks to simply maths to code in efficient way.
I liked this solution, it is for sure one of the most pythonics and cleaners i saw.
I think this is the first time I've ever seen a recursive lambda. Really cool, thanks.
Maybe because it's truncating, not rounding?
This comment is hidden because it contains spoiler information about the solution
Loading more items...