not the best solution and not very clever.
sum
I 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
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.
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
Loading collection data...
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