7 kyu
Get Smallest Common Factor
269 of 651kodejuice
Loading description...
Algorithms
Mathematics
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.
python new test framework is required. updated in this fork
Approved
For Haskell, the empty list is only checked in the random tests. I submitted a solution that actually breaks for the empty list, but since it was not checked...
For Haskell failed tests could we get more information on which arguments the tests failed? Not sure how to read the following:
Falsifiable (after 2 tests): expected: 3 but got: 255 [17] 15
Did you figure this one out? I'm stuck on the random tests too, wondering what corner cases I've missed.
[edit] Figured it out, I was looking for a maximum instead of a minimum!
This comment has been hidden.
Smallest Common Factor, 2 is < than 20, so its the right answer
Thank you for your reply. Indeed, it was simply my bad.
Ruby random tests:
Description updated.
Why description? O_o
Haskell translation Kumited.
Please review and approve.
Approved!
Many thanks.
I think there are broken test cases. I console.log-ed the array:
Wrong Factor! - Expected: 349, instead got: 1 Log [ 5005, 13585, 7865, 3575, 11440, 1430, 10725, 4290, 715, 4290, 10010, 6435, 7150, 10010, 4290, 2145, 13585, 10010, 5005, 4290 ]
Unless I don't know math, 349 is not the right answer.
Which language? If Python, please resubmit.
It should be
5
. It works fine in Py and Ruby.As you mentioned
console.log
I believe it's JS, and JS version is completely fine. I suspect that you modified the original array in the process.I don't think I've done anything that modifies the original array. My score is usually around 140 passed and 10 failed. There is also 1 error though I don't know how to check that.
I'll post my solution below and mark it as a spoiler. Who knows, I could just be tired and missed something.
This comment has been hidden.
First things first: your code contains a bug.
Try
[3,6,9]
;-)This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
I'm on it.
.
This comment has been hidden.
You're right. A few mins please
Please submit again. Let me know if OK.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Looks fine now :)
Thanks for your patience.
Python translation Kumited.
Please review and approve.
Ruby translation Kumited
Please review and approve.
Both approved
Approved
Smallest common factor. Not greatest common factor. But not 1, unless it's 1.
Why?
A nice twist, of course ;-)