Ad
  • Custom User Avatar

    Funny kata, great to exercise and have fun with, I can't wait to solve and figure out more and better of them.

  • Custom User Avatar

    JS reference solution treats addition as higher priority than subtraction, and probably crucially, division as higher priority than multiplication.

    Fixed tests use exact equality, but that's not the problem; random tests use approximate equality.

    The problem is expected values get so big that 1e-6 absolute error is not enough for approximate equality. Relative errors on the order of 1e-16 get blown up to absolute errors larger than 1e-6.
    The real problem is testing with an absolute instead of a relative margin, because chai does not offer the correct assertion.

  • Custom User Avatar

    I have same code in Python and JS
    Python code passed all the tests, but JS code is having too tiny differences like .0000000000000000000000000001 difference in some tests.
    It should accept too close results. it is illogical to 0.000000000000000000000000000001 to not pass, lol. (Python tests / difference indicators are different from those in JS)

  • Custom User Avatar

    Need to add one extra test case where there are multiple whitespaces in row.

  • Custom User Avatar

    yeah like ("5++5) and (+9+9)

  • Custom User Avatar

    what do you expect from the successor to java script

  • Custom User Avatar
  • Custom User Avatar

    Seriously a kata 8 kyu in C that forces you to do super stupid memory allocations instead of allowing you to copy string and replace space with nul terminator... Why??? I really hate that most C katas just force you to do dynamic allocation, especially when it makes no sense. It is imho stupid to allocate when you do not need to and it is almost never a good practice to allocate when you are not in control of freeing.

  • Custom User Avatar

    Please do not post solutions in kata discussions, thanks :)

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    Your solution is buggy. You wrote the second initial to the wrong position in the output array. Also, you attempt to null-terminate at an incorrect index, and your output array ends up with incorrect characters. You need to make sure the initials are stored in the correct locations of your output buffer.

    By writing out of bounds of allowed buffer, you trigger undefined behavior, which breaks tests completely instead of failing gracefully with readable output.

  • Custom User Avatar

    Example of what the test falsely "expects":
    Sam Harris
    expected:
    A^A_Ðf.�
    but got:S.@H

  • Custom User Avatar

    Yeah, I regret writing that translation. The problem with letting the user return nested pointers like char ** is that in good logic they should then also write a corresponding custom freeing function, e.g. void free_words(size_t n, char *words[n]);. But then many users would just leave it blank, because the tests would not check its correctness (it's not impossible to do so, but it is very cumbersome and clunky); so it would make for an awkward kata that asks to write two functions but can only reliably test one of them.

  • Custom User Avatar

    I don't like how this kata enforces a specific memory layout of C strings. If it wasn't so strict I could have just stored them back to back in a single allocation and just used the strtok output. That would have been nice

  • Loading more items...