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 explenatoryI have this tingling sense telling me that the same message could be carried with a bit milder, less explicit wording. You are strongly encouraged to try next time, would you.
This comment has been reported as abusive
This comment has been reported as abusive
For anyone wondering, this is definitely and absolutely NOT best practice! Its not even a clever solution.
This comment is hidden because it contains spoiler information about the solution
@akar-0 LMAO
Because people voted for it.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I think you dont even need to work of this edge case.
"abc"[1...-1] # => "b"
"ac"[1...-1] # => ""
"a"[1...-1] # => ""
Thats the only one that may be a problem
""[1...-1] #=> nil
i think its not a good Ruby practice to use the "return" keyword in the last statement