Ad
  • Custom User Avatar

    "...the idea is to substitute the examples into the formula and reduce the resulting equation to one unique term. ...Using this pattern, only one solution is possible for each test..."

    But hold on! The uniqueness of solution is disapproved by the example in the description itslef: [ "a + a = b", "b - d = c ", "a + b = d" ]. The expected answer is '2a', however '1b' (or just 'b' - what a strange requirement for explicit 1!) is also a correct answer and it is simpler than the expected one!

    Need to revise the kata for either accepting all possible single-term answers (the preferred approach), or making the rules more specific.

  • Custom User Avatar

    About the diagram: [0,7] is the starting position of yellow blob, size 5. This is given in line 6 of sample tests and diargem T0 shows it correctly. After the fist move the blob has relocated to [0, 6], so the print_state should get it as [0,6,5], correpsonding to line 17 of sample tests, and diagram T1 shows it accordingly. I don't see any faults.

    About the wrong result: since no fusuion is involved here, I guess, you have a silly mistake in the code, chaning the size instead of a coordinate. What I've got (as probably all others) matches the expected result.

  • Custom User Avatar

    Actually it wasn't misunderstanding. Just a silly mistake in the code

  • Custom User Avatar

    "the higher frequencies are, the lower the length of their encoding should be (can also be equal for non-powers of 2)"

    Why powers of two should make the difference?

    For the frequencies [('b', 2), ('e', 2), ('g', 4), ('i', 8), ('m', 16), ('n', 32), etc,
    my Python code gets: b: 000, e: 001, g: 010100, i: 010101, m: 010110, etc.

    So, 'g' has frequency 4 (2²) and code 010100 length 6; 'i' has frequency 8 (2³) with code 010101 also length 6. Both frequencies are powers of two, have same code length, but I don't see any problem with that, as there are no frequencies between 4 and 8.

  • Custom User Avatar

    Solved in Python without problems. However in Java this is a real nighmare. For some reason (rather illogical to me) the task wants the result (as an option) to be also placed in provided output stream. But how it should be placed: just bytes, or DataSteream.writeCharts, or DataStream.writeUTF - no clue. Whatever I do it, fails.

  • Custom User Avatar

    Of course, for this kata you can store the size and use in for freeing. However, in general this is not a good practice, as the module can be called several times and even concurrently. Therefore it appears logical to me that the calling function should handle that.

    My work arround was placing NULL pointer at the end, so I loop until NULL is found. It's better than storing size, however I don't really like even that.

  • Custom User Avatar

    Function 'free_pins' in C implementation requires also an argument 'count' (returned by function 'get_pins'),
    specifying the number of pin compibations.

  • Custom User Avatar

    447 is the correct value.

  • Custom User Avatar

    The phase ""Ties may be broken arbitrarily." in Java and maybe other versions is WRONG. In case of same frequence, the bigger word lexicographically must go first. Ortherwise random test may fail.

    The punctuation characters I used: space, ? ! # @ ( ) \ / . , : ; _ - .
    Some of them may be redundant.