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
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
Done, thanks for the tip.
At the end of the month, the newly deposited money does not compound. Only the money existing in the account before the new deposition will compound. In other words, the money compounds before the new deposition.
Looking at your solution, you might want to note that
r
is already given in monthly percentage. Therefore, it should not be divided by12
..
This comment is hidden because it contains spoiler information about the solution
Thanks for the tip, mauro-1. I've now modified the length test to incorporate your suggestion.
This comment is hidden because it contains spoiler information about the solution
Damn, I thought 42 characters was the optimum, but you managed to pull off 41. Well done!
Loading more items...