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.
You're....right. So why is my code thinking it is when it understands smaller numbers??.....weird. It shouldn't be hitting long overflow.....
You do know that in Python tests,
X should equal Y
X
is the value your function returns andY
is the expected value right? The non integer value was produced by your code, that's not the input value.I apologize, this is for python, I did not mutate the input, those lists were pulled from the failed test cases.
34060 is not.
One of the java tests is wrong.
expected:<([18078,34060)(2262,34060)(25545,34060])> but was:<([6026,11353)(754,11353)(8515,11353])>
All of the first set, above are divisible by 3.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Sure, you're caching, but it depends on your use case. If someone needs the factorial for 500 (let alone 1000), they're probably doing something wrong.
That's true
Using a loop would be more efficient than calling
factorial
all the time.It's called caching.
If you use itertools you 1)could theoretically handle >1000 if the computation weren't ridiculous, and 2)wouldn't have to calculate 990 unnecessary factorials to find 10!.