Ad
  • Custom User Avatar

    The zeros must come in the order they appeared in the original array. There is no specification for strings or integers first.

  • Custom User Avatar

    I restricted all prototype methods to be consistent - if you don't need it, then it shouldn't be a problem. This kata is not in seek of a creative solution but rather one for a challenging problem.

    I'm assuming you're the other user to flag a minor issue - like I said before, is there anything that's actually an issue other than your opinion on the problem?

  • Custom User Avatar

    You aren't allowed to use arrays. What I meant by The solution is very simple using language features and/or temporary arrays is that without the restrictions I've set in place for this kata, finding a solution is not very difficult.

    I'm under the impression you did not clearly read the description of the kata. There are no "hidden restrictions and caveats". I've clearly stated -

    The zero elements must also maintain the order in which they occurred.

    and

    You are NOT allowed to use any temporary arrays or objects. You are also not allowed to use any Array.prototype or Object.prototype methods.

    That's the point of this kata - to raise a challenge. A subjective feeling shouldn't be the cause of reporting a minor issue.

  • Custom User Avatar

    I made a note indicating the restrictions in both the description and sample code comments. I'll address it better in the description to clear up any confusion.

    This kata was designed for a challenge given the restrictions. The solution is very simple using language features and/or temporary arrays. What did you intend to use .toString() for?

  • Custom User Avatar

    I think I was experiencing tunnel vision on the inc/dec sequences, haha. Nice work.

  • Custom User Avatar

    Yep, that was a bug which has since been fixed haha.

    As for finding a solution - you can use temporary values, just not auxiliary data sources such as an Array or Object.

    You are correct when saying you need to move all elements each occurrence of a zero.

  • Custom User Avatar

    Thank you for pointing that out! I made an escape error in the regex validation of the source code. I also added comment stripping so it won't be an issue anymore.

  • Custom User Avatar

    Man, I swear we always have such similar solutions haha.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    My point is that your statement in the Kata description is not entirely true.

    Isn't it annoying how "string".replace(find, replace); only replaces the first match of the find string?

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    So I'm not quite sure why this is incorrect.

    Test Failed: Expected: Take one down and pass it around, 98 bottles of beer on the wall., instead got: Take one down and pass it around, 98 bottle of beer on the wall.

  • Custom User Avatar

    I realized after writing this, how fragile it is.

  • Loading more items...