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
Yep, works now.
Overly tight error margins:
expected 843253.1448715855 to be close to 843253.1448715873 +/- 1e-9
.
This comment is hidden because it contains spoiler information about the solution
https://www.codewars.com/kata/5a77f725b17101edd5000020/ is the same problem with similar complexity requirements, although it only asks for the optimal time, not for an associated solution sequence.
This comment is hidden because it contains spoiler information about the solution
I don't get the test case
height: 1, width: 1, y: -4, x: -9, thought: 'Mirrors'
At time t = 0, the text 'M' starts at
y = -4, x = -9
and does not appear in the view.At time t = 1, the text 'Mi' starts at
y = -3, x = -8
and does not appear in the view.At time t = 2, the text 'Mir' starts at
y = -2, x = -7
and does not appear in the view.At time t = 3, the text 'Mirr' starts at
y = -1, x = -6
and does not appear in the view.At time t = 4, the text 'Mirro' starts at
y = 0, x = -5
and does not appear in the view.At time t = 5,
y > 0
and the text can no longer enter the view.Thus, I return
0n
, but the test expects5n
. Why?This comment is hidden because it contains spoiler information about the solution
Both mine and Fbasham's solutions sometimes fail a random test. For example, both of our solutions fail the following test (with equal output):
Either our solutions or the author's solution is buggy.
This comment is hidden because it contains spoiler information about the solution
Definitely an issue. Without sufficiently large values of
n
, a simple for loop will do. However, larger values ofn
will require values ofr
increasingly close to1
to avoid overflow or underflow.IMHO, this kata would work much better with integer-only inputs, with output taken modulo a large prime. This would eliminate all accuracy concerns.
I believe the reference solution is currently broken. It does not apply the modulus correctly, so it often produces wrong answers for large inputs.
This comment is hidden because it contains spoiler information about the solution
Loading more items...