Ad
  • Default User Avatar

    Performancewise would be "better" to use a StringBuilder or StringBuffer (using the .append() method) as it is faster to reallocate memory for a growing object, than creating a new object in each loop iteration.

  • Default User Avatar

    Yes, it is working. But it also mutates the inputArray, which might be unwanted and is considered bad practice. It would be better to keep the function pure and return a new array instead.

  • Default User Avatar

    Thank you for the good explanation. But my question was, why exactly this above solution does not execute properly? If I run it against the tests of this Kata, I get the SIGSEGV. Did some compiler change here?

  • Default User Avatar

    This solution gives me a SIGSEGV (11) error. Same as my original solution did.
    What is wrong?

  • Custom User Avatar

    What about these magic numbers 15 and 20?
    I am not an experienced C programmer, but I think it limits the input to a number with 15 digits? I think this should be implemented more generic to be "Best Practice". It is not a big deal to get the number of digits of an int.

    Am i wrong?