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.
not the best solution and not very clever.
sum
for the result of the addition makes the code more self explenatoryOkay, thanks for that !
Great solution but it has me a little confused.
How does the last section of code convert the sum into binary ?
Thanks
.
Wouldn't that depend on what your expected behavior on having a non-integer input is? Depending on context, returning without raising an exception could just create problems.
\m/
Wouldn't this method fail if either a or b is nil ? I noticed that a lot of kata solutions don't take those cases into account. Whilt adding a simple guard clause:
return unless a && b
would cover this.Aha - the test case is actually correct, the variables could be named better though. I've renamed
false_key
tokey_with_falsy_value
to make the intention uber crystal clear :)I've also added an extra sentence in the description that mentions this. Thanks for the feedback!
That's true, however it doesn't hurt performance to use double quotes when not interpolating.
Personally I prefer to use double quotes all the time for consistency (I follow option B from the Ruby Style Guide).
This comment is hidden because it contains spoiler information about the solution
Because one-liners are a way to push you harder with some extra challenge, plus it is still competitive coding: you are meant to show off a bit :p
But thanks for taking your time considering my work :)
Why make it 1 line though? Seems antithetical to general best practices.
I'll work on that ;)
too few semicolons for my taste ;-)
An empty array will only return true when the sum required is zero.
Added an example in the description.
Loading more items...