Ad
  • Default User Avatar

    Same is mine solution - in bash it takes 5s on my VM box, and fails test with time>12000. Sad (

  • Default User Avatar

    Your code contains undefined behavior:

    while (args[j] == args[j - 1] + 1)
    {
      j++;
    }
    

    you are not checking the bounds of args in this loop. It may read past the end of the array.

  • Custom User Avatar

    In C, there is 100 tests with n choosen randomly between 5k and 100k.