Ad
  • Custom User Avatar

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

  • Custom User Avatar

    In real time production code is this recommneded ? since it's not a part of C standard.

  • Custom User Avatar

    Just for information, this feature (case X...Y) is not part of C Standard, it belongs to GCC compiler extension

  • Custom User Avatar
  • Custom User Avatar

    the problem comes from your code, you are assuming that ordered is zeroed, but since it's an output parameter it can contain anything when your function is called.

  • Custom User Avatar

    The "..." actually represents all the other integers between (for example) 60 and 69.

    case 60...69:
    return 'D;
    

    is a more concise way for

     case 60:
     case 61:
     case 62:
     case 63:
     case 64:
     case 65:
     case 66:
     case 67:
     case 68:
     case 69:
     return 'D';
    
  • Custom User Avatar

    so switch can deal with ranges? good to know

  • Custom User Avatar

    What does the "..." mean?

  • Custom User Avatar

    No, the lines are clean and without tricks, maybe you have the same problem as me, adding words to a line, I separated them with a space and got a line with an extra space at the end, and the tests gave an error, despite the fact that the lines matched

  • Custom User Avatar

    Some of the random input test strings seem to include non-printing characters, that are not included in the expected results strings. Using something like strtok will pick up these characters, but if you try to printf to debug you won't see them. for example:

    for words:
    "m2 n3 oe4pwks nrrg9prjnr yi8etyad wrlymis1 7eld 6 yasdw5owy"

    expected:
    "wrlymis1 m2 n3 oe4pwks yasdw5owy 6 7eld yi8etyad nrrg9prjnr"

    but got:
    "wrlymis1 m2 n3 oe4pwks yasdw5owy 6 7eld yi8etyad nrrg9prjnr"

    Copy and paste the input and expected strings from this example into one of the example test calls, and it will come back correct.

    So it seems that to get the correct answer, you must fullly sanitize the input. The input strings are not clean!