• @aschattney, I managed to get the Kotlin translation approved; finally :).

    Thanks for creating it (and for your patience).

    Also, sorry if the description changes I made caused any additional issue. This kata has been getting more activity recently, and I noticed that the description was not clear enough in some parts, so I decided to revamp it and address some the common problems people were having with the description.

  • Weirdly, even though I hit the 'Approve' button and the HTTP request is made, your translation is not getting accepted. I don't know if it's a temporary issue with Codewars. I'll have to try again later; if that doesn't work, we'll have to try again with a new translation from scratch.

  • Approved.

  • Approved. Thanks for the translation.

  • Hi,
    I cannot see your solution, so I cannot comment on that. Without more specific details or a solution already submitted, there's not so much I can tell you.

    That said, if you're sure that the array of possible combinations you are creating is right (that is, the values pass the tests), then you are in the right track already; I'd suggest you stop using the array, and instead, just use a counter, a variable where you keep the count of the solutions you find. You don't need to keep the combinations themselves, just the number of them.

    However, as mentioned at the beginning, as I don't see your solution and don't know what approach you are taking or how your array is generated, so I don't know how useful my suggestion will be.

  • Approved.
    Thanks for the translations.Although I am not familiar enough with the languages and just gave a quick glance to this translations, they look good to me, as they seem to be based off one of the existing solutions. I see that the approach you took for this was using pre-calculated values, which is different from the one I took when I created the kata, but it's fine.
    It's interesting to see the different approaches people take to solve the problem.

  • Thanks for the translation.

  • @ajgrinds:

    In summary, you can ignore it. I wrote it as optional info and as something you can use to check yourself if you're going in the right direction.

    As mentioned by @RobsonMoon, it's trivia and not a restriction of the challenge; that's the reason why I added it as Optional Extra.

    Also, as mentioned, that knowledge could be used to write your own practice tests. Indeed, one of the Kata's tests (not part of the Sample Tests), checks that the sum of combinations of lengths from 4 to 9 adds up to 389112, but that's just something internal.

  • Thank you for the translation. I've just approved it.

  • Glad you liked it.

    I've found other similar katas along the same lines if you want to try them, although they're harder:

  • Hi, thanks for the feedback.
    Regarding the first comment, the use of special unicode chars was mostly part of the challenge.
    However, this issue definitively makes it a duplicate. I didn't see that kata when creating this one, although ironically after checking it out it turns out I had solved that one some years ago and didn't even remember :). I didn't find similar katas when creating this one (probably because of different wording).

    Anyways, as that one is more general and established-enough, there's no point in keeping this one.

  • Don't worry. Don't beat yourself up so hard with that, this kata is harder than it seems. At least you now know some of what you need. The core idea behind this is about converting automatas to regular expressions. I would advise you to:

    1. Get familiar with the basics of regular expressions in JS, including using the regexp literal (i.e.: /this is a regexp/g).
    2. Solve some easier katas that involve regular expressions.
    3. Learn about deterministic finite automata (DFA) or finite state machines (FSM).
    4. Learn about how to convert an automata to regular expression. Use pen and paper. This might help.
    5. Try to convert the automata that appears in the link in the Note section (in the description) to its equivalent regular expression, once you have it, just transcribe it.

    In addition to all that, you might want to know where that automata comes from (it took me a long while to understand that :) ), I would advise you to read on how to calculate modulus of large numbers by reading one digit at a time (I had a couple of katas related to that). Once you get the idea, you'll realise that the automata is basically doing that (calculating the modulus reading one digit at a time), is just that the automata states represent the current modulus (0, 1 or 2).

  • Unless there's something else going on, it probably means that you're not using a regular expression. Those tests are to avoid people trying to trick/bypass the test by using some object with a test function or people trying to override the test function of RegExps. If that's not your case, and you are indeed using a regular expression, let me know to try to troubleshoot it.

  • Take into account that there's a difference between the sample tests, and the actual tests. That applies for most katas out there.

    When you submit the kata, the actual tests are run, which include among others: random tests and tests to check false negatives and false positives. You can try to use a similar function with your RegExp to check for false negatives (multiples of 3 that are not recognized as such) and the same goes for false positives (non-multiples of 3 that are reported as such).
    If your code is failing one of those functions, it means that your RegExp is missing some multiples of 3 or recognizing some non-multiples of 3.

    Try to create a for loop that covers a range of numbers, convert each number to binary and test your regexp, to see if it matches all the numbers it has to match and misses all the numbers it has to miss.

  • Loading more items...