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.
my person did the math that I was too lazy to do myself. Props to you
No idea. I'm not a mathematician. I simply found the pattern. For all I know, it doesn't hold at the 1e10th number. However, the number 9 plays a role in many tricks, facts and formulas in the decimal system.
Interesting deduction. I didn't notice it myself, so my method ended up being a pretty naive number-skipping method.
Is there any place where I can find a full proof of that fact?
I'm pretty sure it means you've passed these tests so far but got a timeout before you passed the next one
My solution is literally passing all random tests (50 small, 10 medium, 2 large) and still getting a timeout. How is that possible?
But how can this be the case if all cases were solved?
your code passes that test ("single solution"). Either that's not the problem you're facing, or you should reset the trainer.
Closing
In the "single solutions" list, there is the following problem:
Input
[6, 0, 0, 0, 0, 0, 0, 0, 2]
[0, 0, 3, 6, 0, 1, 7, 0, 0]
[0, 7, 0, 0, 4, 0, 0, 1, 0]
[0, 5, 0, 9, 0, 4, 0, 3, 0]
[0, 0, 9, 0, 0, 0, 1, 0, 0]
[0, 6, 0, 7, 0, 8, 0, 2, 0]
[0, 3, 0, 0, 6, 0, 0, 5, 0]
[0, 0, 5, 3, 0, 9, 4, 0, 0]
[7, 0, 0, 0, 0, 0, 0, 0, 3]
to which my program provides the following output:
Output
[6, 1, 8, 5, 9, 7, 3, 4, 2]
[4, 9, 3, 6, 2, 1, 7, 8, 5]
[5, 7, 2, 8, 4, 3, 9, 1, 6]
[2, 5, 7, 9, 1, 4, 6, 3, 8]
[3, 8, 9, 2, 5, 6, 1, 7, 4]
[1, 6, 4, 7, 3, 8, 5, 2, 9]
[9, 3, 1, 4, 6, 2, 8, 5, 7]
[8, 2, 5, 3, 7, 9, 4, 6, 1]
[7, 4, 6, 1, 8, 5, 2, 9, 3]
And yet... it says the solution is invalid. What is going on?
This is the ugliest code I've written in my life. I'm so happy it at least works.
Dude, just how freaking efficient does this thing have to be?
This deserves more upvotes! I see so many solutions that are literally summing lists of numbers when you can simply do it in constant time with a bit of arithmetics.
It's a constant time solution, and it is properly modularized. Perfect.
I don't find that unreadable. You gotta get used to reading long arithmetic expressions, especially when it saves your solution from being linear over the value of a parameter.
Exactly!
Finally someone who did it right!
I'm seeing so many solutions that are linear over "number", when it can be done in constant time like this.