Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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 expects 5n. Why?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Both mine and Fbasham's solutions sometimes fail a random test. For example, both of our solutions fail the following test (with equal output):

    Block:
    [[0,0,3],[1,0,1],[0,1,0]]
    
    Observations:
    [["3B",2],["2C",2],["1B",2],["2C",2],["2A",2],["3C",0],["1C",1],["2A",3],["1C",3],["2A",0],["2B",2],["2A",3],["3C",0],["3C",2],["2A",3],["2B",2],["3A",3],["3B",3],["1A",2],["2C",2],["3A",2],["3B",1],["2A",3],["3B",2],["3A",1],["1C",3]]
    
    : expected [ '1A', '2B' ] to deeply equal [ '1A', '2B', '3A' ]
    

    Either our solutions or the author's solution is buggy.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Definitely an issue. Without sufficiently large values of n, a simple for loop will do. However, larger values of n will require values of r increasingly close to 1 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.

  • Custom User Avatar

    I believe the reference solution is currently broken. It does not apply the modulus correctly, so it often produces wrong answers for large inputs.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Done, thanks for the tip.

  • Custom User Avatar

    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 by 12.

  • Custom User Avatar
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Thanks for the tip, mauro-1. I've now modified the length test to incorporate your suggestion.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Damn, I thought 42 characters was the optimum, but you managed to pull off 41. Well done!

  • Loading more items...