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.
JS can only handle number less than 10 ^ 16 before switching to exponentiation form.
You have two options:
When I discovered this kata, I just read the title, then I began to work on an algorithm based on my assumption.
After quite a struggle, I opened the editor and saw the full description: well wrong algorithm, but it was easy to adapt it.
Thanks for the challenge anyway! :')
Hello.
If you meet an exponential form, you might have chosen the brute-force solution: (1) generate the full answer, (2) then use some ways to check the digits at the end, (3) then judge whether they are zero, (4) then add your counter if there is another zero.
However, there are some other ways to count them, especially when there are some patterns.
Another possible way (I think I can expose that the n in test cases are not that formidably large) is to handle the multiplication (to say, when the product > 10000000) yourself. You will need a list or an array to do that: if you use a list of integers (just name it as l), you can use l[0] for the highest (or lowest) digits, and operate as you were in classrooms of arithmetic. You can make your coding easier by have one digit per element, or use different base (e.g. 1000, 1000000, or 65536 or something alike).
If you would like to count something, you will not always need to generate the full result first.
A viable suggestion for solvers might be try to work out n = 1, 2, 3, 4 to something like 15 (not too big), and guess the pattern / try to find out what is really affecting the solution.
In JS, the large number tests are making it impossible to solve, I think. For numbers like 589 they get so large that the product is just (1312312313xE^24) or something like that and it can't be parsed.
Your Kata (Ruby version) needs more extensive test coverage to prevent easy cheap-cheat solutions and/or logically flawed solutions. The most common way to increase test coverage is through the inclusion of randomly generated test cases at runtime so please add these. The lack of test coverage in a Kata as an Issue is recognised as an official CW stance.
There are literally no instructions. You have to look at the tests to discern how to write the solution.