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.
Can do arr.sum instead of arr.reduce(0, :+)
@aerotune @travelerspb I see what you mean. I appreciate that not mutating the original string is better, I added a new solution here: http://www.codewars.com/kata/reviews/55f20b5169b42aa91b0000dc/groups/5b1ccdb7777ab7180e000130
What I strive for is to go the 'confident ruby' way of narrative code, where managing the input is clearly distinguished from the work performed on that input.
Thanks for your comments!
definetely a bad practice
wow
As mentioned by samzhao2008, I'm getting a
undefined local variable or method 'employees' for main:Object
error in the Ruby version.Can not reference variable employees in ruby version. Is it a special task leave for me to find it?
Oh, yes, thanks for your reminder. When I outputs the input, I finds that there is something wrong when dealing with big number.
Lots of people passed the Ruby tests so I think something is wrong in your code. Did you print the input? It can help you to see the problem.
weired error happened to my ruby solution:
...
Test Passed: Value == 1246
Test Passed: Value == 541
Test Passed: Value == 45001
Test Passed: Value == 450010
Expected: -1, instead got: 450010
27 Passed
1 Failed
0 Errors
Does anyone face the same problem?