6 kyu

Convert integer to Whitespace format

708 of 1,918MMMAAANNN
Description
Loading description...
Binary
Fundamentals
View
AllIssues4Questions1Suggestions9Show Resolved
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Nice kata, well done.

  • KayleighWasTaken Avatar
  • jadoremath Avatar

    I think there's an error in Tests (JS). I didn't do anything and it just gives me 'ws is not a function' error.

  • __eloise__ Avatar

    Looks like the third bullet point is an accidental duplicate of the second?

    • characters after that and until [LF] are the binary representation of the integer: [space] for 0, [tab] for 1.
    • characters after that are the binary representation of the absolute value of the number, with [space] for 0, [tab] for 1, the rightmost bit is the least significand bit, and no leading zero bits.
  • nomennescio Avatar

    The description is ambiguous, as it does not define the order of the binary representation in the output (nor does it define the maximum length of the representation). Neither does it define the leading zeroes. Only by carefully looking at the example of '2' can one deduce the order. Terms like 'first' and 'leading' are therefore ambiguous too. This should be made more clear in the description.

  • Bliggy Avatar

    I was able to complete all the example_tests but got this error when I initiated random_tests : Test Crashed Caught unexpected signal: SIGSEGV (11). Invalid memory access. I know what this error is but I don't know why this error occurred when the example_tests came out correct

  • z1k0 Avatar

    There is a problem with the bleach() method in Java. It does not read spaces correctly. Just made me mad, i used " " for space as in the description. Could anyone help? edit: I tried this as well : (char)32 . Still the same :(

  • JavaAppa Avatar

    when I try to use the test cases, it gives me this error: TypeError: ws.replace is not a function at unbleach at /home/codewarrior/index.js:20:19 at /home/codewarrior/index.js:25:5 at Object.handleError

    EDIT: Never mind, the issue was resolved. I was returning a number not a string.

  • docgunthrop Avatar

    Elixir translation awaiting approval.

  • Arandolph543 Avatar

    This comment has been hidden.

  • stellartux Avatar
  • Sano91 Avatar

    This comment has been hidden.

  • clcraig Avatar

    C, C++ and Java translations available. Please review.

  • samspot Avatar

    The example tests allow [space], [tab], [LF], but the real tests require " ", "\t", "\n". This was for C# version. The tests should be consistent, especially because the spec specifically mentions we can use [space], etc.

  • jamessral Avatar
    ✘  Expected: " \n", instead got: " \n"
    

    Is there something wrong with the Tests? This is for the test with 0 as the input

  • user5036852 Avatar

    C#-Translation kumited!

    https://www.codewars.com/kumite/57b2ec4b1fae8aeefb000290

    Please check and approve!

  • ITSOES Avatar

    There's a slight problem with the Ruby test cases. If the RNG picks 0, then the test expects " \t\n" even though the correct answer is " \n".

  • pioraid Avatar

    This comment has been hidden.

  • pioraid Avatar

    I committed a Ruby translation.

  • adam-tokarski Avatar

    Thanks for Kata. Good occasion to learn new language, even esoteric one.

    It may be temporary, but given link (http://compsoc.dur.ac.uk/whitespace/) actually doesn't work.