Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
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. :/
(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.Yeah, that got it.
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.
The desired return type could be a lot more clear... took me a while to grasp what you wanted back.
I got that too, submitted just now.
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.
tfw your code is 5 times longer than everyone else's...
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.I think where you're going wrong is that your
for
loop capsi
byn.length
rather than the value ofn
.Also your short-if should probably have a false condition with
:
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)
This comment is hidden because it contains spoiler information about the solution
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.
This comment is hidden because it contains spoiler information about the solution
Loading more items...