Ad
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    This is because strings are an iterable, with each character as a seperate element. It's the same reason you can do "for char in s".

  • Custom User Avatar

    Indeed; I tried to remove that two days ago when making wthit56's edits, but it appears the republish didn't complete. Now it is removed.

  • Custom User Avatar

    Thanks for the feedback. Often do I wish for a strongly-typed javascript. It is explicit in the description that

    This should be a general function that takes as input any positive integer, and returns an integer
    

    and I used the quotes mainly to reduce confusion when talking about numbers of digits ("there are 2 1s" is weird). I can add a test case that checks the type explicitly; in addition, I might replace all " with inline-code backtics ("there are two 1 digits"). Would that solve the problem?

  • Custom User Avatar

    This was fun. I formatted mine to show that it can generalize to arbitrary dimensions, if anyone's interested.

  • Custom User Avatar

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

  • Custom User Avatar

    One of my favorite katas! It's a lot of fun to use entirely recursive solutions.

  • Custom User Avatar

    What I wouldn't do for one-based arrays

  • Custom User Avatar

    Great kata. You could make the tokenization a little harder by including a molecule with a multi-digit number in it, like C6H12O6.

  • Custom User Avatar

    I'm torn about ranking this. On the one hand, the actual statements involved don't invoke anything more complicated than a first-class function. On the other hand, the solution requires a good bit of research, or having taken precalculus.

  • Custom User Avatar

    I feel like I cheated with eval(); maybe you want to disable that?

  • Custom User Avatar

    One of the examples is wrong.

    It says 0.001 == 1e-2, but my JS console (and my high school math) say 1e-2 == 0.01

  • Custom User Avatar

    Since we're working in both minutes and hours, can you clarify the units on each function input?

  • Custom User Avatar

    I'm not certain we're talking about the same thing; I was suggesting an additional test case where you pad e.g. -27 to -00027.

    In any case, it will mean many submitted attempts will not work; however, the submitters will not lose honor or rank progress, and they will be able to update their solution to make it validate all the tests again. This same thing happened with the What Century Is It? kata. Beta is a good time to make these changes.

  • Loading more items...