6 kyu
Simple Fun #141: Hamming Distance
748 of 1,674myjinxin2015
Loading description...
Puzzles
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.
Why 34013 and 702 = 7 insted of 5?
34013 = [1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1] 702 = [1, 0, 1, 0, 1, 1, 1, 1, 1, 0]
So There are 5 diffrences + first array is longer by 6 so it can have 5 or 11 diffrences If u count len of array
For example: [1, 0, 0, 0, 0, 0, 0, 0, 0] [1, 0, 0, 1, 0, 1, 1, 1, 0]
have 4 diffrences which is correct
Example 2:
[1, 0, 0, 0, 0, 1, 1, 1, 1, 1] [1, 0, 0, 1, 1, 1, 1, 0, 1, 0]
has also 4 diffrences which is correct
And Example 3:
[1, 1, 0, 0, 1] [1, 0, 1, 0, 1, 1, 1]
has 2 diffrences + secound array is longer by 2 = 4 and it's also correct
disable exponents and built in binary conversion to make it harder
LC translation
this translation modifies the description
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/129.
Please join the discussion to help us identify duplicate kata and retire them.
This kata was upheld.
Hello, i have a question. Why is 34013 and 702 equal to 7? If you compare them, you get 5. 34013 = 1000010011011101 702 = 1010111110
This comment has been hidden.
This comment has been hidden.
Not an issue. You must compare
bits
, as it is clearly stated, and that doesn't depend on the method you use to get the binary representation (btw you don't even need to actually convert numbers to a binary representation to solve it).Moreover your message could be considered as a spoiler since you gave one method that can be used to solve the kata. Please use a spoiler flag when doing this (I set it for you this time).
Ok thanks!
Don't know if it's a mistake, but the description for C says that a and b are between 1 and 2^20, but one of the basic tests uses 2^32 (UINT_MAX)... Doesn't make the kata any harder, but it's still an issue with the description.
Fixed.
python has errors i do not know why? some right and some wrong
The error comes from your code. Use the error message to investigate what's wrong. This may help too: https://docs.codewars.com/training/troubleshooting/
Haskell translation
Thanks :)
C++ version is missing headers for integer types everywhere. Also the types themselves are missing
std::
prefix everywhere.Should be fixed now.
Neither sample nor final tests are completely fixed...
I don't see it, what's wrong exactly?
?
FArekkusu, Happy New Year! :)
Okay, I looked at the tests again and see that there is a
using
statement foruint32_t
- the issue is fixed, you can forget about it.C++ translation (author inactive).
Thanks :)
COBOL translation (author inactive).
approved
Factor translation
(Author inactive)
approved
Python, C# and JS testcases are a mess full of unused stuff, need to be cleaned.
done for JS, also updated to
Node 14
Thanks. Ruby needs cleaning too.
C# update available: https://www.codewars.com/kumite/58d36195c5574ce26500010a?sel=61cdd02e2eb6480007d34021
Approved, thanks!
Python and Ruby still need cleaning.
python done
and Ruby done
C translation (author gone)
Thanks :)
C# tests throw warning:
tests/Fixture.cs(99,15): warning CS0219: The variable 'passed' is assigned but its value is never used
commented out, but C# will need to be cleaned up too
Ruby translation should be updated 3.0, see relevent information here: https://github.com/codewars/content-issues/wiki/List-of-Ruby-Kata-to-Update
done