Ad
  • Custom User Avatar

    yes, absolutely true! Although I explained this point in a comment before. But then I didn’t know how to use formatting, and it was very difficult to understand the code that I wrote in the comment.
    It's a pursuit of brevity.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Yes, thanks, really very stupid mistake.))))
    The number finds itself, as in a mirror

  • Custom User Avatar

    You also have O(n), if you want to find solutions with the best result, then there are other sites for this, where this is emphasized. Or you can post 2 solutions. One is short, the other is optimal.
    For all arrays of type [0,0,0,1] you have the same result.

    I don't think you'll get extra points for fast execution here.

  • Custom User Avatar

    Agree with you! But I did not redo it, just one of the solutions. Monument to curvature. Now I would write it differently

  • Custom User Avatar

    by js guru - OverZealous

  • Custom User Avatar

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

  • Custom User Avatar

    I would put "Clever" but too short solution in comparison with other similar ones, just 2 pages))

  • Custom User Avatar

    Ok, I guess I can't understand the task. As I understand it, the results should be as follows:
    [SOUTH, EAST, SOUTH, SOUTH, EAST, NORTH, EAST, NORTH]=>[EAST,SOUTH,EAST,EAST].
    [NORTH, EAST, SOUTH, NORTH, SOUTH, SOUTH, SOUTH, NORTH, EAST, NORTH, NORTH, EAST, SOUTH, EAST, SOUTH]=>[EAST,EAST,EAST,EAST,SOUTH]
    [EAST, NORTH, EAST, SOUTH, NORTH, NORTH, SOUTH, EAST, SOUTH, SOUTH]=>[EAST,EAST,EAST,SOUTH]
    I missed "Write a function dirReduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side)."
    Sorry, "side by side" by google translator like: "Near", "in the same array".
    If there was such an example, I would understand the error right away

  • Custom User Avatar

    C# tests are wrong:
    test(7):
    input=[SOUTH, EAST, SOUTH, SOUTH, EAST, NORTH, EAST, NORTH]
    Test Failed
    Expected is <System.String[8]>, actual is <System.String[4]>.
    But 4 is right!
    test(10):
    input=[NORTH, EAST, SOUTH, NORTH, SOUTH, SOUTH, SOUTH, NORTH, EAST, NORTH, NORTH, EAST, SOUTH, EAST, SOUTH]
    Test Failed
    Expected is <System.String[11]>, actual is <System.String[5]>.
    test(8):
    input=[EAST, NORTH, EAST, SOUTH, NORTH, NORTH, SOUTH, EAST, SOUTH, SOUTH]
    Expected is <System.String[6]>, actual is <System.String[4]>

  • Custom User Avatar

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

  • Custom User Avatar

    For C #, the conditions are different. Needed for (t * 2> 9) -> (t minus 9), not return 9. Therefore, tests fail

  • Custom User Avatar
  • Loading more items...