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.
Use single quotes unless string interpolation is required.
yes but ruby probably created like 1 million objects under the hood which is why this is the slowest lol
This comment is hidden because it contains spoiler information about the solution
Well I'll be damned...
seriously!? :)
But the solution requires you return an int, so if it overflows, no solution could do it correctly (your solution throws an exception)
Correct. In cases where operators are the same precedence, we also have to take into account the associativity to determine the order of evaluation.
A bit late, but doesn't it solve from left to right?
This comment is hidden because it contains spoiler information about the solution
omg I tot it will only remove the first instance of the element it found! Didn't realise it will remove all element...
I know this is an old comment, so this is for whoever sees this.
Ruby seems like a bit of an outlier, as it's naturally less verbose
than most other languages. At least in my experience, once you become
familiar with all of the most commonly used ruby methods, one liners
like this can actually be just as understandable (if not more so) as
more verbose code.
At first I was like "that can't be it", then I remember that Ruby loves us <3
LOL, love ruby
O(m+n) is not a valid big-O time. This solution is O(n).
<3 Ruby!
I wonder what the space-time complexity of this solution is. My guess is O(m+n), but not too sure.
Loading more items...