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.
(Integer.MAX_VALUE)! is so INCOMPREHENDINGLY huge that we probably won't ever need the number of trailing zeroes lmao
If anyone ever does, PLEASE contact me so I can see why
negative factorials don't have a value, mathematically or computationally as far as I know, becaues of the definition
n! = n*((n-1)!), where 0! = 1
this is also the reason for some other funky mathematical phenomona, but this is a CS site so
point is, this function will never be used for values where n is an element of (-∞,0)
Completely forgot you could multiply i in a for loop, this is the upgraded version of mine
what if n is -6?
An important skill in software engineering is reading the requirements thoroughly.
It doesn't filter negative values; if we have -10 and -5 as inputs, this function would return 49.
https://www.codewars.com/kata/reviews/55172ce3236c8829ae000596/groups/5bb680fd16a8f1ca17000e8c
Is this better or worse?
I prefer to filter out by invalid values n,m. Then there is no unneeded multiplication happening
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
No, but return value is integer anyway, so there is no possible way to return correct value using integer. We can return 0 in this case, because input data will be kind of incorrect, but I don't think it's a good way to solve the task.
Description says: "Input will always be a non-negative integer.", so we can omit handling this case
What about negative values? For example n = -5, m = -4. I think it should return 0. Your solution will give 19.
Will this solution work if
(n * m - 1) > Integer.MAX_VALUE
?Nice solutions!!!
Loading more items...