You need to sign in or sign up before continuing.×
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.
For those of us who aren't familiar with the Euclidean algorithm, getting the job done efficiently is clever enough. As for the more acceptable way, I don't recall learning that shortcut in school, but here it is... could have saved me trouble many a time during programming puzzles.
It's always time to learn some regex, but familiarity with str's methods can handle this one simply as well.
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 was happy to see someone take the same succinct approach, and then I see you one-upped me with the variable arguments.
This comment is hidden because it contains spoiler information about the solution
Ahh, the default case was the icing on top.
This comment is hidden because it contains spoiler information about the solution
I'm just happy that I was able to factor all this out and come up with the right solution on the first try. I've been out of math class for a while.
But you found it. Don't kick yourself too hard. Computers aren't only used when you know the full formula. They're also used to discover formulas, work around the unknowns, or bypass the tedium. In this case, you didn't readily know the formula but were still able to solve the problem.
This comment is hidden because it contains spoiler information about the solution