Ad
  • Default User Avatar

    I think the description should more explicitly say ALL '0' tiles will be unlocked at the start. This threw me off, since I think Minesweeper in Windows used to make me uncover zeros myself (so there might still be islands of zeros not yet discovered). I could be wrong about that, it's been years since I played Minesweeper. Still, it's an important detail I didn't notice until I read through the comments.

  • Default User Avatar

    I'm getting the same thing.

    I copy & pasted my solution out to a html file to test it in Firefox (which I end up doing a lot when I'm stuck). Turns out I can break my solution by feeding it really long arrays (9k+) which some of the other commenters here mentioned were in the random tests, I get too much recursion.

    Well, so much for that idea. :/

  • Default User Avatar

    (JS) That one was getting me too. When I did a console.log on the predefined colors object... I noticed the keys were lower case, and I needed to convert the argument to lower.

  • Default User Avatar

    Yeah, that got it.

  • Default User Avatar

    Nothing much, maybe a section called "Function should return" that states you want the same array back, with the inelligable people removed, and the elligable objects modified. It's a minor nit-pick, and I don't mean to raise it as anything important... it'd just help to digest the problem faster.

  • Default User Avatar

    The desired return type could be a lot more clear... took me a while to grasp what you wanted back.

  • Default User Avatar

    I got that too, submitted just now.

  • Default User Avatar

    The order matters. If you only have 2 checkouts, they must first serve 6 and 9, then 57 and 10, before either checkout gets to serve 328. At that point, which ever checkout is available first will get 328.
    So the queue will be processed in that way, and at the end, when all customers have been served, both checkouts will have spent a total amount of time on the customers they served. And that's the value you need to look at.

  • Default User Avatar

    tfw your code is 5 times longer than everyone else's...

  • Default User Avatar

    I gave up trying to solve it with regex, and I'm only loosely grasping this one, but I can break parts of it down.

    \B states that the match starts at something that isn't a 'word boundary', I think this ignores the commas after they're inserted. (and possibly the start of the string itself, since that will never need a comma)

    (?= [...]) is a lookahead assertion, so we're trying to test if where we're currently sitting in the string is followed by these rules. We have to use this lookahead instead of matching the digits themselves, because we're not trying to replace the actual digits, just find the right position in the string to do inserts.

    \d{3} is looking for 3 digits, and wrapping it with ( )+ wants to match that pattern one or more times.

    ?! is a negative lookahead assertion, so with (?!\d) we don't want one single occurance of a digit after our groups of 3. I think what this effectively does is snap the selection to the right hand side... working backwards in groups of 3. Seeing if we're in a valid part of the string by testing whether we can count to the end in steps of 3. (I would have gravitated towards using $ here to achor the end, but I couldn't solve it using regex, so just ignore me)

    And the /g is the global flag which I think repeats the whole operation multiple times while the condition is present.

    If you take off the /g flag and watch it run once:
    1234567 becomes:
    1,234567
    And you can see the "counting in clusters of 3 digits from the right hand side" idea working.
    And if you imagine it running again on:
    1,234567
    The position that begins 234567 doesn't qualify, because it sits with a word-boundary , to the left, so that digit gets skipped until the next valid position, which starts at 567 (becuase of the 3 digit rule). At which point the replacement repeats (because /g) and then there are no more valid matches in the string.

  • Default User Avatar

    I think where you're going wrong is that your for loop caps i by n.length rather than the value of n.

    Also your short-if should probably have a false condition with :

  • Default User Avatar

    I keep getting somehow disconnected, where I can't submit a solution and it tells me to check my internet connection. Is there some way you can make this more robust where I don't have to reload the page to fix it? (and sometimes that doesn't even work)

  • Default User Avatar

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

  • Default User Avatar

    Little help?
    I think the test cases are failing me on my own exceptions?

    30 Passed
    0 Failed
    6 Errors

    The 6 errors are all the exceptions I'm throwing, they show up in red, and the whole solution appears to fail beceause of them.
    I've tried:
    throw new Error("message");
    and
    throw "message";

    Is there some other syntax I need to use here, or should this work ok?
    I had this problem with another kata, never could figure it out.

  • Default User Avatar

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

  • Loading more items...