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.
clever
You could harden it such that you figure out which IP is greatest and swap the subtraction, but I believe the challenge rules laid out rules about the expectations.
but why would start ip > ending ip ?
You can easily set the place of each argument before calling the method.
It looks nice but shift is pretty expensive.
But what about if start ip > ending ip?)
Case insensitive.
So, regex will trigger to AEIOU too.
This comment is hidden because it contains spoiler information about the solution
Hahaha, smart solution ^^
Well, description limits n to 0 <= n < 1000000000. I think gsub(/.../, '\0,') would be shorter and faster than scanning for variable length.
Nope, I didn't realize
\Z
also caught trailing newlines. Thanks for the heads up! I'll update my solution.EDIT: Turns out this is my old solution. Its already been improved.
Not sure if you're aware, but I noticed a couple of potential issues with your solution.
\Z
matches trailing newlines, although not anything beyond that. (\z
doesn't!) And\w
equates to[a-zA-Z0-9_]
as well, so you'll accidentally consider an underscore to be an alphanumeric character, which you might not want!:-)
One of the requirements is that it must throw NoMethodError if the Hash doesn't include the key. If a default is defined, this solution will return the default anytime the method is missing even if the key doesn't exist.
Still, it passes all the tests and it's succint. Kudos to you!
nice
One char longer than my solution. :P
I'm humbled by this solution and I have learned much from it.
Loading more items...