You need to sign in or sign up before continuing.×
Ad
  • Custom User Avatar

    You are right, indeed. Having gained some experience since the time I posted the solution, I would change the variable "new" to something like "translated", and the function name "dictionary" to "translate_leet". Thanks for the tipps!

  • Custom User Avatar

    Very bad practice to name a variable as 'new' which even if is not a C keyword, it is keyword from C++ to whom should be kept compatibility, almost always. Also dictionary is not suggestive enough and it may be ambiguous.

  • Custom User Avatar

    I was not aware of memory leeks back then :) I am now

  • Default User Avatar

    what about memory leaks?

  • Default User Avatar

    Thanks!

  • Custom User Avatar

    Solved it, but I am still curious why this was an issue.
    When I allocated space for the result string, I have replaced
    char *str = (char*)calloc(400, 1);
    with
    char *str = (char*)calloc(200, 1);
    and it passed the last (random) test.
    Great Kata!

  • Custom User Avatar

    Hi! My solution (in C) passes all the tests, except the final, random one(it gets an incorrect result with many weird characters in it).
    However, when I run the code inside CLion, it gives me a correct answer for that random test.
    What could be the problem?

  • Custom User Avatar

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