• Custom User Avatar
    1. Your edge case when n = 0 is incorrect - the description does not mention that you should return NULL in this case. In fact you should return the empty string (why?)
    2. Your malloc()ed buffer does not account for the number of times n the string is repeated so it is often too short to contain the result
    3. A malloc()ed buffer contains garbage values by default so you need to initialize it properly before performing string operations on it such as strcat()
  • Custom User Avatar

    The heck is a static int in javascript?

  • Custom User Avatar

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

  • Custom User Avatar

    The description "forgets" to mention that you need to return a freeable array.

    Yup, you read it right: Dynamically. Allocated. Array. Of. Size. Three.

  • Custom User Avatar

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

  • Custom User Avatar

    No extra variables! just the arrays passed.

  • Custom User Avatar

    nice ! It will not need math.h

  • Custom User Avatar

    Issues and question are not mutually exclusive.

    I have apparently incorrectly assumed that the tests were the same because of the name and I admit it did not even occur to me to print the input. I also did not know I could see the tests after solving it. Thanks for the response.

  • Custom User Avatar

    The tests are fine, your code is not. Check how you validate the input values.

  • Custom User Avatar

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