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.
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 doesn't reinvent the wheel which is what makes it a good solution.
If the kata wanted us not to use Matrix#det, it should have locked that method.
But what about if start ip > ending ip?)
sure using matrix... this is cheating
This comment is hidden because it contains spoiler information about the solution
Hahaha, smart solution ^^
Golfing here, not writing a production calculator in 3-4 lines of code... far from best practice, if you actually used this I would laugh at you...
Golfing here, not writing a production calculator in 3-4 lines of code... far from best practice, if you actually used this I would laugh at you...
I guess using this calculator you could simply inject random code in, so it's not a "best practice," but it's certainly effective.
Example of 12-year-old troll breaking your calculator, and its machine:
Calculator.new.evaluate(system("rm -rf *"))
The same way I did it, but my solution supports Ruby 1.9.3+ :)