Ad
  • Custom User Avatar

    Just solved in Go.

    My solutions was assuming the array of indices was sorted based on the examples and it woked for all the solutions.
    I was also asuming the array contains no negative indices.
    But, reading the description, the assumptions were just not correct.

    About the first assumption, I suggest to either ...

    • include the assumption that the indices are sorted in the description
    • or add test cases where there are indices greater than the input string lenght before some actually valid indices.

    About the second assumption, I suggest to either ...

    • include the assumption that the indices are always positive
    • or add test cases where there are negative indices. And even better if they are placed before some actually valid indices.
  • Default User Avatar

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

  • Custom User Avatar

    I think that there must be some issues in GO (golang) tests.

    I belive I've the solution. The only doubt I've is when both arrays are empty. For the moment, I'm presume the result should be true in this case.

    My solution passes all the initial tests, all the random tests and many of the "basic tests", but one of them is failing.

    I've placed logs to see where my solution was failing and it's when both arrays are empty (It was expected to be false). So, I changed the condition to return false in this case and the new solution still fails and still does when both array are empty, but now, it seems to be expecting the result to be true.

    I haven't seen the tests but it seems that a test case is duplicate but with different expected results...

    Please, can someone confirm?

  • 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

  • Default User Avatar
  • Custom User Avatar

    I hope you enjoy this solution ;)

  • Custom User Avatar

    Using arr.toSet() instead of just arr as optimization for really long arrays. Usually, it won't be necessary.

  • Custom User Avatar

    Hi, I've just submitted a solution knowing it won't work with negative integers.

    I suggest you update either the definition to exclude negative integers or the test cases to test negative integers as well.

  • Custom User Avatar

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

  • Custom User Avatar

    It's part of the task requirement

  • Default User Avatar

    The warnings appeared when C was automatically updated to CLang8/C18. These warnings don't prevent you to pass the kata (they are only warnings) so it is not an issue (you can notice that 805 people passed the C kata). Nevertheless I modified the translation so that there are no more warnings but due - it seems - to CW problems I have not been able to republish the C translation. I will try later.

    Update: at last C translation was re-published.

  • Custom User Avatar

    There's an issue with the C translation. A warning in setup.c:3:13:

    setup.c:3:13: warning: implicitly declaring library function 'strlen' with type 'unsigned long (const char *)' [-Wimplicit-function-declaration]
        int l = strlen(s);
                ^
    setup.c:3:13: note: include the header <string.h> or explicitly provide a declaration for 'strlen'
    1 warning generated.
    

    I think that it is supposed to be fixed by replacing

    // setup.c
    // ...
    int l = strlen(s);
    // ...
    

    with

    // setup.c
    #include <string.h>
    // ...
    unsigned long l = strlen(s);
    // ...
    
  • Custom User Avatar

    Wouldn't it be better to accept any iterable like range or tuple?, for me they are good options too

  • Custom User Avatar

    It seems that every word in the tests is lowercase. Is this a feature or a bug?