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.
You are not alone man
Those are both correct, make sure you're looking at the cubes for the second array.
For that second test case you end up getting back 110 for the first array & 405 for the second.
Finally, there is one empty table for two and another one used for ne group of two clients.
The first and second clients may have been proposed a table for two if a > 0 and if all tables for one were used.
This comment is hidden because it contains spoiler information about the solution
Yes,
(...looks like moon phases to me... 8o ... XD )
Nice one.
I suggest to add a visual description.
First example :
1 || 🌕 || 🌑 🌑 || 0
2 || 🌕 || 🌕 🌑 || 0
1 || 🌕 || 🌕 🌗 || 0
1 || 🌕 || 🌕 🌕 || 0
Denied : 0
Second example :
1 || 🌕 || 🌑 || 0
1 || 🌕 || 🌗 || 0
2 || 🌕 || 🌗 || 2
1 || 🌕 || 🌕 || 0
Denied : 2
13 people are denied service, and
13
is the expected answer. Where's the problem?in javascript, total denied number is more than N group, and even bigger than N person, is it a bug?
restaurant( 2, 1, [2,1,2,2,2,2,1,2,1,2] ) = 13 ???
Really nice kata! Thanks for this one :)
I get this random test (2, 1, [0,-1,2,2,2,2,1,2,1,2]) expected 13, which weirdly the result of sum all elements in t. Cuz if we ignore -1, the result should be 10 right?
Maybe just my code haha.
you get only ones and twos
Can I ask what to do if t[i] < 0 ? Couldn't figure it out.
Thanks in advance.
I have the same problem. In case you haven't figure it out, you have to pass the inital number in to the array.
Cheers.
Oh I see, thanks a lot.
Loading more items...