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.
The description warns you:
that's the main issue. when you fix that, that test will work (but another is still failing, there are some out-of-order calls). In any case, that's a problem with your code , not a kata issue
is never a good argument, especially not with threading and concurrency ;-)
This comment is hidden because it contains spoiler information about the solution
Hi, I had the same problem. Locally my code is running properly, println() prints numbers from count() method in correct order, but tests say that I return an empty array.
The testTrickyQueues test data looks like this
And expecting
new int[]{0,1,5,6,5,1,0,1,0}
Let's work thru the first few floors...
0
going UP1
who wants to go to floor6
. They get in. Lift contains {6}5
wanting to go to floor6
. Three people get in. Lift contains {6,6,6,6}. Still going up.6
. Everybody out. This is top so now lift will go DOWN.5
wanting to go to ground. Those three get in. Lift contains {0,0,0} and is going DOWN*...
You can see that so far the lift has stopped at FLOORS
0,1,5,6,5
.... which is the first part of the required Kata answer.~
I leave the rest as exercise for the reader ;-)
Cheers!
[],
[0, 0, 0, 6],
[],
[],
[],
[6, 6, 0, 0, 0, 6],
[]
I need your help:) Looking at the instructions on this "testTrickyQueues" input I understand (and this is what my code does) is that:
From the bottom, the first "passenger" in queue seeks to go down - thus the Direction of the Lift is set to DOWN.
Since there is someone on the 5th floor (3 "passengers" actually) who also seek to go down, lift should me smart enough to regonize this and:
firstly go to floor 5, pick 3 "passengers" than on the way down on the floor 1 collect 2 additonal "passengers" and let 5 pepole out on the ground floor.
So now the queues on each floor look like this:
[],
[0, 6],
[],
[],
[],
[6, 6, 6],
[]
With this logic, the output is at this stage is:
[0, 5, 1, 0] and there are still "passengers" awaiting.
I'm failing 2 from 16 tests, one of them is "testTrickyQueues" and it says that:
arrays first differed at element [1]; expected:<1> but was:<5>
Meaning that we should ignore the fact that on the 5th floor three pepole are willing to go down and pick up the passengers from floor 1.
Which doesn't make sense considering the instructions but I MIGHT simply misread them
@Álex Vega Don't forget the spoiler flag.
This comment is hidden because it contains spoiler information about the solution
Hey g964, thanks for comming back :) Yeah, I just realized I was reading this incorectly;P my bad
The given property (P) is correct. If there were an error I hope somebody would have seen it before you:-) Did you give it a try?
Since it's expected to raise the elements of the array/list (the base) to the power equal to the base itself, as shown here:
"solve([2, 1, 3, 4]) returns [2, 11] :
(22 + 11) * (33 + 44) = 5 * 25 = 125 and 2 * 2 + 11 * 11 = 125"
then,
shouldn't this:
"P = (x(1) ** 2 + x(2) ** 2) * (x(3) ** 2 + x(4) ** 2) * ... * (x(m) ** 2 + x(m+1) ** 2)"
be this:
"P = (x(1) ** x(1) + x(2) ** x(2)) * (x(3) ** x(3) + x(4) ** x(4)) * ... * (x(m) ** x(m) + x(m+1) ** x(m+1))"
?
Would anyone be able to help:)? I'm getting errors saying that I'm not returing anything. Well, it's not the task to return, but to call the count() method with the correct parameter which I do ;|
Is the implementation of counter() method taking care of returing the i? My code is running properly on my local machine (where I've implemented a simple Counter class with counter() and a println) but when I migrate the countInThreads logic to this kata it fails. I wonder what's the implementation of Counter class here
This is a really nice Kata:) Thank you. The only thing which strikes me is that the 'Battleship field validator II' kata is like 2-3 times harder to solve but it's the same kyu level
java.
But I just checked and the ref solution returns false for this input.
@dawidszewczyk: that's not the input that caused your solution to fail. Check that you're logging appropriately in your code (like, do you have an early return before you might log?)
Invalid issue, closing. But if you actually find one, plz continue the discussion (with other inputs, but double check that's the correct one and that you didn't mutate it before you print it)
cheers
Java!
Loading more items...