5 kyu
Count Decimal Places
361 of 367edalorzo
Loading description...
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.
No random tests.
I just wrote a solution to this (my first 5 kyu problem!), and it works perfectly in my repl, but exactly one case (2.e-14) keeps coming back as failed. In my repl, it produces the expected output (14), but I keep getting the same message here that it produces an output of 0. Any idea what's up with this or what I can do? Thanks so much! (also, sorry if this is not the appropriate forum for this kind of question).
Nice kata, just translated into both Ruby and Python, if you want to approve them :)
[And writing the Python version without regexes was rather fun, I must admit ;)]
Thanks for writing this kata, edalorzo! Some comments though:
I think you should add a test case for a number > 10 that has more than one significant digit. For instance, 160, or 175. I say this because my first solution wouldn't have handled this correctly, though I think my current solution does.
Also the description should really mention how
NaN
and infinity should be handled, and not leave the user to discover this from the test cases.IMO, the kata description could also be more helpful by explaining what a decimal place is.
Thanks for your feedback. I have addressed all your comments to my best understanding of your requirements. I hope that makes this Kata better.
The coffeescript is not written properly. You just copied the Javascript declarations.
I will review it later, for the time being I will get rid of the coffee script version of the code. Thanks for the feedback.