Ad
  • Custom User Avatar

    Read the description again, your code isn't 100% right, and please stop posting "as always it works in vscode and not here" if you don't use the exact same input in both places, that's what would happen.

  • Default User Avatar

    The kata is fine; I am the 12,880th person to succesfully solve it in JavaScript.

    This means you rather instead should not like the incomplete coverage of tests in your VSCode environment.

  • Custom User Avatar

    Don't like this test, as always passed in VSCode and basic solutions but don't pass random tests.

  • Default User Avatar
  • Default User Avatar

    Please do not post code without using the spoiler flag (otherwise others can see it). I have added the flag to your comment. end.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    fair enough, it is now specified in the initial code

  • Custom User Avatar

    Please mark your comment as a spoiler and use appropriate formatting when posting code. See https://docs.codewars.com/training/troubleshooting#post-discourse.

    Expected vs returned is exactly the same [...].

    That is false. Please reread the description and look at the sample tests to see the expected output.

    Not a kata issue.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The unspecified encoding is an issue tho. Without this information, its not known how to interpred the characters in input.

  • Default User Avatar

    chars in C are not Unicode codepoints, they are 8-bit bytes. is the Unicode codepoint U+2660 (9824 in decimal) and cannot possibly fit in a 8-bit char with any of the most widely used Unicode encodings (you can see how it is represented by various encodings here). Your code accesses the last byte of the string and compares it to the UTF-8 decimal encoding of the codepoint: this cannot possibly work for characters beyond ASCII. In this kata, the encoding is indeed UTF-8, because it is natively supported on Linux, on which Codewars runs. The string "♠" will be represented by the following bytes in memory: {0xE2, 0x99, 0xA0, 0x00}. Indexing the string like string[idx] gets only one of these bytes, not the whole codepoint. However, one critical property of UTF-8 is that it is retrocompatible with ASCII, and therefore with <string.h> functions like strcpy() and strcmp(). Code like strcmp("♠", "♥"); will work fine. Knowing this, you can craft a better solution.

    Please use the question tag to ask for help by the way, an issue is a provable bug in the kata.

  • Custom User Avatar

    No, it's not the expected behavior, but it's also not what really happens. I would suspect that you are using printf without a newline, but it's hard to tell without seeing the code.

  • Custom User Avatar

    I'm trying to solve the C translation of this kata but I'm getting more than one card together (if I use printf, I get "3♣Q♠"). Is this the expected behaviour?

  • Custom User Avatar

    Because we have instruction for our code behavior

  • Default User Avatar

    There are some disturbing tasks to be found in muddy waters of 8 kyu.

  • Loading more items...