7 kyu
Greatest Common Divisor Bitcount
453 of 1,092obnounce
Loading description...
Binary
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.
python new test framework is required. updated in this fork
Approved
If you have troubles with tests, remember that tests may have negative numbers.
This comment has been hidden.
This comment has been hidden.
Haskell : https://www.codewars.com/kumite/5be3060ab9a39c8b06000166?sel=5be3060ab9a39c8b06000166
The generator is very basic, but I checked and it produces non-trivials frequently, and +/- enough to cover all cases. If you want to see it, just uncomment the when block.
The solution is very much an
8 kyu
in Haskell ..For the Ruby version the method name should've followed Rubyy's naming convention and be
binary_gcd
, instead ofBinaryGCD
(which, given the first character is upper case indicates a constant or class.downranked from 6 to 7 kyu
nice kata, a bit too easy for the scoring IMO
(C#) It would be nice if the description said how to handle cases where only one of the input numbers is zero.
C#-Translation kumited!
https://www.codewars.com/kumite/57a0f9df7cb1f31db70026d5
Please check and approve!
Here is also a C#-Translation for you wonderful story! :-)
I hope you like it!
Egh.. I've tried several algorithms, and I fail at a one that requests 1 while I return 29 to it.
doTest(BinaryGCDtest) / by zero
Awkwardly, I cannot find out why my code will not validate. It validates all the tests but not after I submit it.
Hi, I've added a Python translation, if you want to approve it, instructions for the approval process are here.
This comment has been hidden.
Added a bunch of random tests including negative numbers.
That's better, but there are no test cases where
y
is negative...You're right. I added the same amount of tests with x and y flipped, so we'll get both tested now.
This comment has been hidden.
No, I appreciate it. I think I've solved the issue / added the appropriate test cases.
Thanks! Looks good. I had to fix my solution again, but that was the point. :-)
Good lesson for all of us how hard it is to get even a simple piece of code right if the specification or the tests aren't complete.
More tests needed. Especially random tests.
Thanks- added 2 random tests.