Need clarification for the requirement

  • 2

    Expected: false

    Why [1,2,3] + [4,5,6,6,8,9,9] doesn't meet the requirement of "each subsequences consist of at least 3 consecutive integers"?

    Expected: true

    If [1,2,3] without a split is considered as valid, then [1,2,3,4,4,5] as a whole should also be considered as valid. Becuase it contains 3 consecutive integers "1,2,3".

    The answer might want to require the output subsequences to contain only consecutive numbers, but that's not what we read from the description (at least it's ambiguous) at this moment. And I don't want to guess the requirements from the test cases anyway.

  • 2

    @RunRunCode Good question! The problem description is unclear (or considering your example: wrong). It says: "each subsequences consist of at least 3 consecutive integers." However, considering the test cases, it should have said: "each subsequence should satisfy both of these conditions: Firstly, all elements in the subsequence should be consecutive integers with no duplicates. Secondly, each subsequence should contain at least 3 elements." [4,5,6,6,8,9,9] satisfies the second condition, but not the first condition. Consequently, it returns false.

Log in to reply

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