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.
Check the hint at the bottom:
aight thx
There are two problems with your solution:
n = 30
,30!
has 32 digits but JavaScript'sNumber
can hold ~16 digits at most. When your values get larger than 16 digits, the least significant digits are lost and you cannot use them reliably for this problem.n
can go up to1_000_000_000
. Calculating1_000_000_000!
will take forever, and your naive solution will not work because it will be too slow, and will eat up whole available memory.You need to find some better approach than calculating the exact value of the factorial.
oooooo clever
What I did............
Good copy paste training, the hint is over powered ;p
Not a suggestion. Please do not post hints without a spoiler flag.
This comment is hidden because it contains spoiler information about the solution
facepalm
This comment is hidden because it contains spoiler information about the solution
great
It's realy simple. In this description, they told "a couple of dragons". So , if your bullets are egal or more than a couple of dragon, it's true. Else, it's false.
This is not exactly correct. to sovle this kata, you do not need "a very specific manner". You need to find a way which is fast enough, but there is more than one such way. The slow ones will not work, but all fast ones will work. You need to use any of the efficient algorithms.
Counting with fingers will not work either, you will run ouf of fingers. Does this mean the kata is wrong?
Your perfectly working code doesn't work for the input range. You can't ask for a smaller range so your code works. The kata is not flawed and not all the people who solved it had to google how to do it. Sorry if you didn't like it, but it is what it is.
What you should learn from this kata is that which algorithm you use, depends on the input values. The description literally says you shouldn't calculate the factorial, so don't expect doing the opposite to work.
I know someone had replied earlier. But I'm sorry to say, its just not a solid argument that 17k other people have compeleted this. I know I wrote perfectly working code. If your tests can only work, if you coded it a very specific manner, then the entire kata is flawed from the ground up. It doesnt teach anyone anything if you have to go do a google search to get the solution.
Loading more items...