5 kyu
Simple Fun #206: Factorial Digits
191 of 458myjinxin2015
Loading description...
Puzzles
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/67 Please join the discussion to help us identify duplicate kata and retire them.
This comment has been hidden.
This comment has been hidden.
Not exactly true, I managed to pass it with O(n)
Anyone else returning Infinity for 777 ?
The user's already solved the kata.
This comment has been hidden.
This comment has been hidden.
Most likely it indicates that your code runs out of time, as the input n is in range [0, 10e6] and (10e6)! has more than 50e7 digits. Both computing n! (multiplying for big integer is expensive too) and extracting digits from n! by dividing 10 forms performance bottleneck.
title should be corrected to "Factor_ial_ Digits" to be more clear
fixed
Ruby translation kumited -- please check and approve (note: author is inactive)
Thanks :)
tips pls help
hint: google
This comment has been hidden.
Factor translation
Please review and approve.
.
C# translation. Please, review and approve (the author is inactive).
Python translation republished
approved
JavaScript version should use
chai
with Node 12 enabled.Java translation. Please, review and approve (the author is inactive).
Is it normal that in random tests
tests()
is displayed? I'm not used to Java tests..
JS: the test cases are a mess, full of unused stuff. Needs to be cleaned.
There should be a fixed test with
0
as the input.Done for COBOL in this fork: https://www.codewars.com/kumite/61afc31d87f340001b898856?sel=61b09bfc98fa63001ad42ffd
and in republished Python translation this also fixed
There should be a fixed test with
1_000_000
as the input.Done in JS. Done in this fork for COBOL. Please check, approve and close the issue if it's ok.
Python translation Please, review and approve
It has been rejected.
now i republish it with required changes.
This comment has been hidden.
because it is too slow, you should find a better approach
Your approach is completely wrong. It is not possible to store
1e6!
asNumber
, and using a proper data type it is not possible to calculate it in a reasonable amount of time.COBOL translation (author gone).
approved
Can I use BigInt ?
Nope, as Node 8 doesn't support it.
This comment has been hidden.
Check the docs,
Math.log
uses basee
.Math.log10
is the one logarithm in base 10.Oh, by the way, it's not a kata problem, so next time please post as a question :)
Approved