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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Didn't like this solution readability-wise.
Ex : [5] is the only element in the array :
5 - (5 - 5)
Thanks for this great commented solution. :)
Details: If array is empty, null or None, or if only 1 Element exists, return 0.
This solution will not retun 0 if only 1 element exists.
I'm very new to Ruby.
How does this each_byte handle the requirement to handle odd/even chars differently? :o
Nicely done, I couldnt figure out how to get args to go in one implicit return.
I really like this solution.
It uses common well known funcitons and still results in short understandable code :)
Very easy to understand and short solution!
When I started out I was at a level where approx 7's in PHP / SQL got me around.
Willingness and ability to learn is more important than actual skill for that first job! :=)
Hi,
Didn't find how to report a cheat solution so I thought I would write here.
The solution in Ruby by Poilon is clearly not trying to solve the actual problem but "cheat the way through".
I don't know enough Ruby to understand how it works but maybe it can be prevented with tests.
I'm also having troubles with the Ruby random tests.
Just learning Ruby here so not so sure if it's that or the description.
Testing for [36, 52, 76, 53]
52 would be the closest number to 36 and not 53.
It feels like it's suddenly not the closest number but the second closest.
That should probably be a section in Kata Best Practices.