You need to sign in or sign up before continuing.×
5 kyu
Bit calculator
1,442 of 2,110riomus
Loading description...
Bits
Mathematics
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.
great kata, viva to the author!
anticheat can be bypassed trivially.
The sample and fixed tests are still using
Test.expect
.Also, the random tests could do with rewriting into a loop instead of having the same 3 lines copy-pasted 7 times.
console.log fails somehow because Math.max disabled??
This comment has been hidden.
Fixed
this is weird... my solution that works in Node v6.11.0 throws an error in Node v6.11.0/Babel because floor is undefined (my solution doesn't use Math.floor). perhaps Babel shouldn't be offered for this kata?
This is because a flaw in the preloaded code.
Note to kata author/power users when kata edit is available: also add
var floor
to Preloaded.(And maye also clean up the preloaded code, currently it's quite ugly and unsafe.)
It schould be ok now. What do you mean by "quite ugly and unsafe" ? How schould it look like? I created that at the beginings of CodeWars, so maybe it schould be updated.
Okay, I'm writing an issue, please wait warmly...
This comment has been hidden.
Nice trick, I think that we should pass that solution. Should be ok now.
Number.parseInt is enabled
fixed
This comment has been hidden.
I would like to translate this kata into C#.
Are you still online?
I am not solving any katas because I do not have time currently, but I am observing CodeWars. You can translate it if you want. Do you want sources?
Thanks for the answer! I'll do it today or tomorrow! Great kata! :-)
This comment has been hidden.
And here it is:
C#-Translation
https://www.codewars.com/kumite/57ab92d37cb1f3ba930000c2
Please check and approve!
This comment has been hidden.
That was a nice kata. Thanks!
Although you probably should block Number.parserInt() as well. I've managed to finish it, second time around, just using that function.
HTH.
fixed
Why are the test functions here different from the ones in all the other kata?
Is ~~ also disabled?
The description implies there could be more than two bit strings to add together. I wrote mine to cater to that, but you might want to add some tests for those cases.
Is there any particular reason you left
Math.pow
enabled? You can pretty easily solve this problem without anyMath
functions whatsoever.This comment has been hidden.
I think you should revise the text and name of the function. Here's some revised text:
Write a function named sumBinary which takes as input two binary numbers represented as strings, and returns the sum as a number.
For example:
Test.expect(sumBinary("10","10")==4); Test.expect(sumBinary("10","0")==2); Test.expect(sumBinary("101","10")==7);
Some math functions are disabled, as well as parseInt.
The following Math functions are enabled: pow, round, random
For
parseInt
and theMath
functions that are disabled, it wouldn't hurt to disable them by replacing them with a function that throws an error message—something like:Then the test output would say "parseInt is disabled" instead of "object is not a function" if someone tries to use those functions.
Totally agree on this. Additionally you should name the disabled
Math
functions. Otherwise the users might try several solutions, which do not work, because they use disabled functions, which would be frustrating.Ok it's fixed.
The test errors were non-descript. I had to console.log to compare what was being passed to what was expected. Probably my fault, but it also took me a couple minutes to realize I was getting errors because parseInt was disabled. Other than that, it's a nice little Kata.
Ok i've added throw to parseInt and described available Math functions
were you thinking about adding negative numbers ? it would be fun :)
Not so bad idea thanks , maybe in another cata so there will be two different difficulty level.