Ad
  • Default User Avatar

    I had to click "view solution" cause I could not understand the instructions. Can't still understand it.

  • Custom User Avatar
  • Custom User Avatar

    In the Kotlin version you have to rename the method to "findSmallestInt" from "findSmallestInteger" for the test to work.

  • Custom User Avatar

    To people having problems: sometimes it's helpful to read the instructions more carefully ;)

  • Custom User Avatar

    Thanks for the answer, I found the problem. And sorry for marking it as issue.

  • Custom User Avatar

    Take a look at the examples anyway. And types.

  • Custom User Avatar

    0xFFFF - input (input types specified by function signature).
    "FFFF" - output (4 bytes);
    0x7F - input (input types specified by function signature).
    "7F" - output (2 bytes);

    Read in the table statements like "HEX ASCII".
    And pay attention to quotes sign
    e.g: "0000"..."FFFF"
    Or statement like "HEX"
    And 0..FF, no quotes sign, therefore it's 1 byte number.

  • Default User Avatar

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

  • Custom User Avatar

    The state should always be 2 bytes. Yes, if value consist of a single digit it should be padded with zero. "00"..."7F" therefore even if passed state is zero, you should write "00" to packet.
    In the examples in the second test case it is padded, it's just hard to see.

    "\x02""FFFF 7F FFFFFFFFFFFF 999999 FFFF\x03\xD7"

    "\x02""0000 00 000000000000 000000 00FF\x03\x24"

  • Default User Avatar

    So I got my stuff working, except that 'state' in the packet is 2 bytes long, and the 'state' passed into the function is only 1 byte long. Thus, I placed the state into the packet, and padded the higher byte with a zero (0). Is this not the correct method? But in the example packet, no zero is padded, and the packet has only a 1 byte state.

  • Custom User Avatar

    Well, then try it out on your own computer.
    You can use strings from basic tests to compare your output, CRC value visible there.

  • Custom User Avatar

    Testing code doesnt modify data located at the 'packet' pointer.
    But still you output should have correct length, like in the specification.
    Most likely "cutting down" is result of two cases either too long output or incorrect overlaying pointers.

    No terminating zero character is needed.
    Count bytes and correct pointers.

    The "Issue" category is assigned for issues regarding Kata implementation(e.g. solution testing code, description).
    If you have issues with solving you should post in regular discourse category.

  • Default User Avatar

    I am using printf, but if it fails, I get no returned printf info from the codewars server.

  • Custom User Avatar

    You should be able to use "printf" even when solving katas.
    And you can use a static value of crc, in example tests if you will look at the end of example packets you can see a CRC value like "\xD7" in "\x02""FFFF7FFFFFFFFFFFFF999999FFFF\x03\xD7" packet.

  • Default User Avatar

    I have been - I just don't know how to test my code further to find out why it does not work. If the test does not work, the debug information is not passed back from the server whatsoever.

  • Loading more items...