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.
This one blows my mind
I've searched all over the place to find mathematical proof of how this dead-simple algorithm works, but it's seemingly magic lol
I had come up with a pen-and-paper way to construct the partitions by laying them out in a left-aligned triangle and summing up offset diagonals to produce new terms, but couldn't figure out how to put that to code
This algorithm seems to resemble that triangle idea, but instead only needs a single row of numbers, and it doesn't seem to even remotely relate to partitions, yet it works lol
I should really have named "digits" here as "digit_count" because it simply counts the number of times each digit appears in x. This way of doing it only requires a regular fixed-size array of 10 (one for each digit 0 to 9).
(Programming Language: C)
For some reason the straightforward approach did not pass the tests on my end, even though the top answers are just that. I had to optimise further for accuracy and speed lol