You need to sign in or sign up before continuing.×
Ad
  • Default User Avatar

    I'm a little bit confused about the sorting. I understood the order of length and then alphabetically (correct me if I misunderstood)
    The test:

    mix("looping is fun but dangerous", "less dangerous than coding"); // => "1:ooo/1:uuu/2:sss/=:nnn/1:ii/2:aa/2:dd/2:ee/=:gg"

    Shouldn't be the "s" before the "u", despite being the "u" in s1? The same for "1:ii" and "2:aa"?

    EDITED: It seems, as a user says down in the chats, that the order is 1) Qty 2) String number 3) Alphabet

  • Default User Avatar

    Ye, could be the reason, I replaced it with a small func anyways.

  • Default User Avatar

    Hi, I{m having a problem while running tests: "TypeError: Object a has no method 'repeat' ... at [eval]:3:6", being "a" Object a atring (I consoled typeof(c) and it printed "string")
    My line is simply var c = "...." //Assigning a char from a data structure
    ...c.repeat(4);

    Then the error arises.

    Any ideas what could be happen? I tested the code in JS Bin and it works OK

    Thanks!

  • Default User Avatar

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

  • Default User Avatar

    I tried to do in a little improved way of a double for loop, but still timeout.
    What I did is check, for every value of the array, via a eg indexOf(value, pos+1) to see whether a complement value exist, and then save it.
    Sadly still raise a timeout, so the solution is still not fast enough.
    Reading the kata and comments, it's obvious that I have to memoize values, but the problem is that I still don't get how to memoize something in only 1 for loop. I get doing that in simple functions (or recursive), but using recursion will break the stack I guess.
    When you say memoize, how would you thought it? I'm not getting the idea unfortunately.

  • Default User Avatar

    Here's one more, apparently the code "11111100111111" should be "M", but for my code is simply a malformed bitcode, as, for being logical, the correct "M" would be "1111110111111" (repeated pattern of same amount of "1"s that transform to a rate = 1, then same for the zeros). How would be the logic with this kind of patterns? (Now I can't just use the rate = 1 to delete the remaining zeros, as there are 2 instead of 1)

    Thanks!

  • Default User Avatar

    Yeah, that's waht I did, didn't realized of simply print the bits at the beginning. What puzzled me was the timeout, as, as you said, that could be some internal issue with the page, but it appears that was an unterminated loop or something.

    Thanks for the help.

  • Default User Avatar

    Actually I guess it's not that. Reading the comments, with a test like "01110", I'm taking it as a single dot, as the rate is 3 and then there is nothing else.

    For me is not confusion, I'm not confused if is a dot or dash, as for getting the rate I have to read until the next 0 (if there is another way, I didn't get it :P ). Then, using "01110", I'm taking rate = 3 and a single dot, there is no confusion at all.

    My timeout is because (I got it after read the comment), the custom tests have more different cases.

    I think is highly recommended to enter "weird" cases to not get lost with this details, as the timeout should be because my function is not prepared for that cases, as it never ocurred to me something like that (which is my problem, but an extra test would enlighten me :P )

    Cheers!

  • Default User Avatar

    Hi All, I did this kata, passed some personal tests, but when submitting an error is raised telling me that a 6000ms timeout is reached, so aborting the submit.
    I have some RegExp objects, actually one per type of replacement, which I know are expensive to create, but relatively cheap to use.
    Could that be the problem? Is a better way to create only one RegExp and change the pattern inside it without pay the price of creating a new one?

    EDITED: Actually as the personal tests run in less than 60ms, the RegExp objects couldn't be the problem.
    Thanks!

  • Default User Avatar

    Hi! Imade this kata, but the 4th test tells me:
    Expected: 24, instead got: 47

    So there is not a round up problem. The rest of the tests goes fine. Is there a way (besides running with all values) to check what could be wrong?
    Thanks!

  • Default User Avatar

    Hi, I'm trying to complete "Valid Braces" and, although the test ran ok, when I try to submit a message of "Unknown error" appears.
    Does anyone know what could be happen?
    I'm new here, so I don't know if there is allowed to enter code in the comments.

    Thanks!!!