Ad
  • Custom User Avatar
  • Custom User Avatar

    thanks for making the change. i know that const can be cast away; the point is to provide a better interface to the user. i believe input arrays and matrices should be as const as possible on Codewars, to make it clear to the user what they are supposed to mutate or not to mutate.

  • Custom User Avatar

    Updated to const int * const *nums

    But it seems you meant that the user could change the order of raws!

    This declaration just carries informative character because nothing prevents the user to apply casting and forge the matrix.
    This type for matrix is used to adapt to the kata task and probably is not the best type.
    As under the hood all the declared matrices are just consecutives of one array.
    Otherwise, would prefer const int nums[], size_t m, size_t k and use nums[i*k+j] or something simillar...

  • Custom User Avatar

    the user is not supposed to mutate the matrix, so i think the input should be const int *const *nums instead of const int **nums

  • Custom User Avatar

    و الله do not rember the reason for malloc.h as it was six years ago...

    And there is no blind following...
    As it seems reasonable to add empty strings (at least for one argument) because it is a 4kyu kata!

    But anyway i do think there should be a consensus on throwing away empty strings in all languages or editing the description to include them (not just my or your opinion)!

  • Custom User Avatar

    Also in C++, Python and original JS (probably some others)

    So we have to two options here:

    1. update all translations to through away empty strings
    2. edit the description to include a case with empty stings

    And because this kata is 4kyu, then the second solution seems more reasonable!

  • Custom User Avatar

    Hello, thanks for considering the changes. I am not criticizing your work in any way.

    Following the original version blindly is not a hard requirement on Codewars. When it errs, you do not have to carry it over in your own translation. An empty string is not an usual representation of 0, and there are many complaints about them in the Discourse (here is the open issue for C with 17 likes).

    About malloc.h, I would be curious to hear about the technical reason behind its inclusion ?

  • Custom User Avatar

    Definitely, there was some reason for including malloc.h instead of stdlib.h
    and probably you should have to wait for another six years before noting that...

    Despite the reason Updated to include stdlib.h instead of malloc.h

    Added the case with empty string to Sample Test to inform users that there can be such cases to be compliant with the original version!

    Edit: though may be i should not do it because another languages do not inform of such cases!
    So i will remove it from Sample Test

  • Custom User Avatar

    also, the fixed test with an empty string is against the specifications and should be removed

  • Custom User Avatar

    #include <malloc.h> is not a standard C header. can you replace it with #include <stdlib.h> in the initial code ?

  • Custom User Avatar

    Hmm, arr is a pointer to a const integer, good use of arr here.

  • Custom User Avatar

    bro are you coding in assembly?

  • Custom User Avatar

    beautifully safeguarded all contingencies.

  • Custom User Avatar

    lol, didnt even think this was possible to include inline assembly

  • Custom User Avatar

    arguments is a built-in feature in JavaScript that is only available within all non-arrow functions.

  • Loading more items...