Is there a mistake in the test case?

  • 0

    For the case of

    compareVersion('1.2', '1.10')

    Shouldn't this return 1 and not -1? Isn't version 1.2 greater than version 1.10? However, I'm seeing the following for my submission:

    Input: "1.2", "1.10"
    Output: 1
    Expected: -1

  • 0

    Oh, I see what the question is asking. 1.10 is considered the 10th minor version whereas 1.2 is considered the 2nd minor version.

  • 0

    Yeah. That`s right.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.