6 kyu

Reversing Euclid's GCD. Parameters out of results

17 of 130Wittybit
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • tobeannouncd Avatar
  • Blind4Basics Avatar

    Hi,

    In python at least: the unique sample test is totally useless... => needs more than that one.

    Cheers

  • monadius Avatar

    NASM: I recommend to move all preloaded code into tests and rewrite it in C.

  • monadius Avatar

    NASM:

    • The user function should never modify rbx.

    • The result should be in rax and rdx. Inline assembly is not necessary to get user results. Just return a struct with two fields.

    • All auxiliary test functions must be static (gcd, uinf_print, do_one_test).

  • mingmingrr Avatar

    There could probably be a harder version of this kata with higher iterations using a solution in O(log(iterations)) time

  • Wittybit Avatar

    Finally made a NASM version... which barely holds together.

  • ejini战神 Avatar
    • Python new test framework should be used (Refer this & this for more detail)

    • Ruby 3.0 should be enabled (Refer this & this for more detail)

  • ParanoidUser Avatar

    In my opinion, the assertion messages are quite confusing as divisor and iterations are input arguments:

    • In the case, when output A invalid the error is Divisor is not wich was expected expected:<X> but was:<Y>
    • In the case, when output B invalid the error is Number of iterations doesn't match expected:<X> but was:<Y>

    I'd expect to see the error messages addressing output parameters instead.

    Also, here is a few suggestions for the Java translation:

    1. In 75% Java solution hits the Too slow program timeout, which I don't think could be done faster then O(iterations)
    2. Sample tests would be very helpful
    3. The original GCD algorithm mentioned in the description has the 'a-b swap' step which gives a false impression that A and B order matters. Current tests don't count this. If that's expected, I'd add the note to the description. Otherwise, fix the tests to set the order.
  • ParanoidUser Avatar

    A little typo in the description: .. divisor of w[H]ich will be ..

  • KataSideKick Avatar

    This comment has been hidden.

  • user5036852 Avatar

    Nice idea for a kata! Thanks.