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.
Vectors did not come my mind, propapbly it would have been easier with vectors
Wonderfull kata, i enjoyed a lot while i was solving. I think the level is underrated, this kata should be kyu 1.
This comment is hidden because it contains spoiler information about the solution
The recursive backtracking structure is clear, what did you to reach sub 3s performance?
this is the list with mines and the remaining numbers which count of not seen mines in the area. not a normal list for example
"X"
"X" "4" "X"
"X"
"4" = becomes zero because mines are known in around of them
also my solution is accepted in all submissions except if test case have this
Let us just to see the right-top corner in your result:
Are you sure that you get the number by using method
open(row,column)
?Why the number in front of "?" in the second row is 1, instead of 2?
Why your result contains a lot of 0s?
This comment is hidden because it contains spoiler information about the solution
Actually it is very fast. It can complete tests in 3 second. there can be done some optimizations such as in every recursive call "points" variable is recreated maybe it can be done outside of the function
Actually your idea and my idea is the same but I think my solution is more efficient and practical then you and it also has no risk about unbalanced tree. Check out my solution
Nice kata. I am very satisfied with mine solution.
Hi, in the python version
game_map = ? ? ? ? ? 0 0 0 0 0 0 0 ? ? ? 0 0 0 ? ? ?\n
? ? ? ? ? 0 0 0 0 0 0 0 ? ? ? 0 0 0 ? ? ?\n
0 0 ? ? ? 0 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ?\n
0 0 ? ? ? 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? ?\n
0 ? ? ? 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ? ? ?\n
0 ? ? ? ? ? ? 0 0 0 0 0 ? ? ? 0 0 ? ? ? ?\n
0 ? ? ? ? ? ? ? 0 ? ? ? 0 0 0 0 0 0 ? ? ?\n
0 0 ? ? ? ? ? ? 0 ? ? ? 0 0 0 ? ? ? 0 0 0\n
0 ? ? ? ? ? ? ? 0 ? ? ? 0 0 0 ? ? ? 0 0 0\n
? ? ? ? 0 0 0 0 ? ? ? 0 0 ? ? ? ? ? 0 0 0\n
? ? ? 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 0 1 1 1 1 1 2 1 1 0 0 1 2 x
0 1 1 2 x 1 0 0 0 0 0 1 x 1 1 1 1 0 1 x 2
0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 x 2 1 2 1 1
0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 2 x 1 1 1
0 1 2 x 1 0 0 0 0 0 1 2 x 1 1 2 3 2 1 1 x
0 1 x 2 1 0 0 0 0 0 1 x 2 1 1 x x 1 0 1 1
0 1 1 1 0 0 0 0 0 0 1 1 1 0 1 2 2 1 0 0 0
1 1 0 0 0 0 0 0 0 0 1 2 2 1 0 0 0 0 0 0 0
x 2 1 1 1 1 1 0 1 1 2 x x 1 0 1 1 1 0 0 0
1 2 x 1 1 x 2 1 3 x 3 2 2 1 0 1 x 1 0 0 0
0 1 1 1 1 1 2 x 3 x 2 0 0 0 0 1 1 1 0 0 0
but this is not solvable
['x', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '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', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'x', '?']
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', 'x', '?', '?']
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', 'x', '1', '1']
['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0']
['0', '0', '0', '0', 'x', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
['0', '0', '0', 'x', '0', '0', 'x', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0']
['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
['0', 'x', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0']
['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x']
['0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', 'x', '0']
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0']
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0']
['0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', 'x']
['0', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', 'x', 'x', '0', '0', '0', '0']
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
['x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'x', 'x', '0', '0', '0', '0', '0', '0', '0', '0']
['0', '0', 'x', '0', '0', 'x', '0', '0', '0', 'x', '0', '0', '0', '0', '0', '0', 'x', '0', '0', '0', '0']
['0', '0', '0', '0', '0', '0', '0', 'x', '0', 'x', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
this is the list with mines and the remaining numbers which count of not seen mines in the area
ther are 2 possibility mines can have
{(0, 19), (3, 19)}
{(3, 20), (1, 19)}
so this map can not be solved
Congrats!
Finally I did it, medium test were killing me. :D
I had a lot of fun solving it, it was a very nice kata
Loading more items...