Ad
  • Custom User Avatar

    Python. Sorry, forgot to mention

  • Custom User Avatar

    I have a question with regard to tests. Test case: matrix - "[[841, 890], [27, 64]]", times - 6428475085 (so basically, there is 1 counter-clockwise turn).
    Got the following message: "[[890, 64], [841, 27]] should equal [[64, 27], [890, 841]]".

    I do not understand, why my answer is incorrect.

    P.S. JS implementation with the same code works fine.

  • Custom User Avatar

    Found the cause of the error. I have not declared res variable locally, so it got mixed with the test cases.

  • Custom User Avatar

    There is an issue with JS tests:

    In sample tests it requires an array as an output: Expected: ['(A : 0)', '(B : 114)', '(C : 70)', '(W : 0)'], instead got: '(A : 0) - (B : 114) - (C : 70) - (W : 0)'

    Whilst in tests during attempt it requires string (as stated in the kata's description): Test Passed: Value == '(A : 0) - (B : 114) - (C : 70) - (W : 0)'

  • Custom User Avatar

    Elimination of circles (not just concecutive north/south or east/west movements) is exactly the purpose of this kata.

    From other examples section in Kata's description: "In ["NORTH", "EAST", "WEST", "SOUTH", "WEST", "WEST"], "NORTH" and "SOUTH" are not directly opposite but they become directly opposite after the reduction of "EAST" and "WEST" so the whole path is reducible to ["WEST", "WEST"].

  • Custom User Avatar

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

  • Custom User Avatar

    Thx guys, now it works! I guess that focus on Python made me too loose on declaring let/const inside the function. Will keep it in mind :)

  • Custom User Avatar

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

  • Custom User Avatar

    That it why I am suprised to see the result above. I have JS chosen as language, test cases are passed successfully. But once I press attempt this strange error appears.

    Someone mentioned below the problems while submitting the solution - maybe the same case here.

  • Custom User Avatar

    Javascript. Nothing is printed to the console

  • Custom User Avatar

    I am getting this error: "Time: 1856ms Passed: 41391 Failed: 0 Exit Code: 137. Max Buffer Size Reached (1.5 MiB)."

    I use replace method and left/right indexing, so the solution should be pretty efficient (both in time and space comlpexity).
    Any ideas on cause of the error or potential improvements?

  • Custom User Avatar

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