Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
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.
Don't like this test, as always passed in VSCode and basic solutions but don't pass random tests.
Nice kata.
Please do not post code without using the spoiler flag (otherwise others can see it). I have added the flag to your comment. end.
This comment is hidden because it contains spoiler information about the solution
fair enough, it is now specified in the initial code
Please mark your comment as a spoiler and use appropriate formatting when posting code. See https://docs.codewars.com/training/troubleshooting#post-discourse.
That is false. Please reread the description and look at the sample tests to see the expected output.
Not a kata issue.
This comment is hidden because it contains spoiler information about the solution
The unspecified encoding is an issue tho. Without this information, its not known how to interpred the characters in input.
char
s in C are not Unicode codepoints, they are 8-bit bytes.♠
is the Unicode codepointU+2660
(9824
in decimal) and cannot possibly fit in a 8-bitchar
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 likestring[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 likestrcpy()
andstrcmp()
. Code likestrcmp("♠", "♥");
will work fine. Knowing this, you can craft a better solution.Please use the
question
tag to ask for help by the way, anissue
is a provable bug in the kata.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.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?
Because we have instruction for our code behavior
There are some disturbing tasks to be found in muddy waters of 8 kyu.
Loading more items...