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.
i like this solution, because it makes use of ruby methods that i rarely if ever use, upto and keep_if. ;)
hehehe. noice.
or u can save the calculations
Fixed
Wanting to have more tags is really no issue!
Because sometimes we want to convert from one type to another.
I benchmarked it and found it to be at least twice as slow as the ternary implemenatation. It looks nice though.
It's a question of what's more idiomatic. See Avdi Grimm's master work: Confident Ruby
This comment is hidden because it contains spoiler information about the solution
what does the ampersand do?
O(n)
relevant: https://xkcd.com/1445/
Hello
This is the second time i've seen the single & used in a function,
Can you provide some insight into this?
Exactly the one I thought about initially, but this way you would do to square roots, one for nothing :(
Agreed :) Just a habit, I guess.
I think this kind of misses the point of the kata. It feels like your 'clever' solution was really just a cheat. For some of the Katas the point is to figure out 'clever' solutions (aka cheat) but not this one. Or maybe its just a game.
Loading more items...