Ad
  • Custom User Avatar

    I set my max to 1.2e6 and it works.

    const MAX = 1.2e6;
    
  • Default User Avatar

    It may not look make sense at all, think of it like something only JavaScript can do.

  • Default User Avatar

    .

  • Custom User Avatar

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

  • Custom User Avatar

    Take a look at the test example and its diagram. There are a total of 6 columns and 8 rows. Each column represents the space between the vertical rails. This means there are a total of 7 rails and 7 elements (the numbers 0 through 6 at the top, one for each rail) whose positions start in ascending order.

    The first row is 001001, which means there will be two horizontal crossbeams at this row; one between the vertical rails 2 and 3 and another between vertical rails 5 and 6. This means that the elements positioned at these connected vertical rails will swap vertical rails and proceed to move down.

    Each time there is a horizontal crossbeam, the elements going down the connected vertical rails will swap rails. In the diagram, the grey markers on the left indicate the position of each row.

    If this doesn't clarify, then perhaps the linked Wikipedia article in the Description may help.

  • 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.

  • 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"

  • 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

    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.

  • Custom User Avatar

    Yes, a zero is a valid value of crc.
    P.S. use provided 'crc8' function.

  • Default User Avatar

    Thats a mistake. I will correct ASAP. Thanks.

  • Custom User Avatar

    I added an additional description for kata.

  • Default User Avatar

    Yeah, you are right.

  • Custom User Avatar

    Maybe you should put that in the descriptions :)

  • Loading more items...