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.
This comment is hidden because it contains spoiler information about the solution
These two, are touching diagonally:
Please use markdown formatting next time.
test case:
[
1, 0, 0, 0, 0,
1, 1, 0, 0, 0
],
[
1, 0, 1, 0, 0,
0, 0, 0, 1, 0
],
[
1, 0, 1, 0, 1,
1, 1, 0, 1, 0
],
[
1, 0, 0, 0, 0,
0, 0, 0, 0, 0
],
[
0, 0, 0, 0, 0,
0, 0, 0, 1, 0
],
[
0, 0, 0, 0, 1,
1, 1, 0, 0, 0
],
[
0, 0, 0, 1, 0,
0, 0, 0, 1, 0
],
[
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
],
[
0, 0, 0, 0, 0,
0, 0, 1, 0, 0
],
[
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
]
reason for fail: Must return false if ships are in contact
I can't see how is there a ship in contact with another ship here. What am I missing? Tis is the only scenario my code is failing.
I created a fork with verbose comments to explain what is going on in this solution.
I hope I got it right...
Thank's every one for reply I got the problem. It was in checking if a number is Prime or not what I did was check i < Math.sqrt(n) which should have been i <= Math.sqrt(n).
hobovsky that was the first thing that I chacked still no luck , I am probably doing similar silly mistake here, I will try again.
Not a chance because this is also the case where the '1' is not supposed to be tested , for eg (48,2838);
1 is not a prime number. Its probably the problem here.
It seems I have made a mistake. 1 Is not a prime number as I thought.
This comment is hidden because it contains spoiler information about the solution
Maybe you could tell how much you understand and what makes you confused. Symbol? Syntax? Lib?
So we can explain it to you in a better way
I can't understand a single thing that is going on here
Sorry, I have missread the Kata.
It says in the example:
if j = 5:
..C.....m. returns 'Caught!' <-- not more than j characters between
So actually it is my fault. Sorry for posting it as an issue.
I think there's a problem in Ruby.
x= .....DC...m......
j = 3
it says: Expected: "Caught!", instead got: "Escaped!"
How can it expect Caught if the 'C' is 4 units away from 'm'? It won't reach the mouse, so my answer should be correct, all other atempt cases my solution passes.
No kidding.
Loading more items...