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.
Welcome to CodeWars!
I hope your time here is enlightening.
That's quite a piece of code you have there - it looks like it took some time to write and I commend you for keeping track of all the variables whilst writing it.
(Well done for remembering to allocate and free memory for the array of remainders too.)
I have a few points of advice for you to bear in mind for future coding... hope they help:
thirt
, so there's no need to calculate them every time - you can store the literal values as constants.new_number
can be fine (I'd be a hypocrite if I said never to use them!), but if your code is more than about thirty lines, generic names make it hard to keep track of what each variable is supposed to be.If any of this seems abstract, take a look at the solutions of other code warriors.
Ask yourself "If I needed to modify someone else's code to solve a slightly different problem, which code would make it easiest?"
Then try to write similar code yourself.
Practice makes perfect :)