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.
Weak sauce
hardly elegant to use isalnum, more hamfisted and lazy in context of the kata
This comment is hidden because it contains spoiler information about the solution
That's strange. When I print out the second test for the "Pawns increasing and decreasing" case I get this:
Board:
. . . . . . . .
. . . . . . . .
. . . 4 5 . . .
. . 3 . . 6 . .
. 2 . . R . 7 .
1 . . . . . . 8
. . . . . . . .
. . . . . . . .
There is no pawn 9. The pawns are exactly the same for all three "Pawns increasing and decreasing" tests. Only the rook position changes.
Is it possible that your code is modifying the pawns between the three tests? Otherwise I don't know what could be the issue.
Thqnks for the reply,
these were the boards printed by the test cases that failed, I'm not printing them myself (code only prints out a cost matrix).
Hi djkat,
I think you have the wrong board. The board for all three positions called "Pawns increasing and decreasing" only has 8 pawns.
Regards,
brodiemark
A few of the test cases seem wrong:
"Pawns increasing and decreasing; 3 different rook-positions"
"Board:
. . . 1 . . . .
. . . . . . . .
. . . 5 6 . . .
. . 4 . . 7 . .
. 3 . . R . 8 .
2 . . . . . . 9
. . . . . . . .
. . . . . . . .
Min path is 7->8->6->5->4->3->2->1: 21 should equal 17"
-- but doesnt the path have to include 9?
Similarly:
"Board:
. . . 2 . . . .
. . . . . . . .
. . . 6 7 . . .
. . 5 . . 8 . .
. 4 . . 1 . 9 .
3 . . . . . . 10
. . . . . . . .
R . . . . . . .
Min path is 1->2->3->4->5->6->7->8: 21 should equal 15"
-- Path does not include 9 or 10, and eyeballing the board it does
seem like the best path goes R -> 3 -> 4 -> 5 -> 6 -> 2 -> 7 -> 8 -> 1 -> 9 -> 10 = length 21....
please advise if i'm missing something with the test case descriptions, but the opther 62 test cases pass...
def better, but i'm biased :)
This is the right soln. it be (real) analytical
pretty much the only challenging part is checking if number is prime, or iterating primes to a large enough bound within the time limit.
Kinda crap. Test cases so cumbersome that the only way to solve the problem is to look for the explicit formula. No coding skill required.
What kind of witchcraft is 'arr[0::,-1::-1].transpose()'?
if i is a square wouldn't your code add it's root twice to divs?
I pretty much did this! I would have never thought of some of the solutions above :p
Cheers!
Loading more items...