The problem is unclear and tests seem contradictive


  • 2
    D

    Two test cases:

    [1,2,3,4,4,5] yields false
    [1,2,3] yields true

    If the original array without split can be a sub-sequence, then [1,2,3,4,4,5] can be a sub-sequence where 3 consecutive integers are present. So the result should be True.

    If it's not, then how can [1,2,3] be True?


  • 2
    L

    I am also confuse about the description of the problem. I thought the subsequence is constructed by a series of integers including at least 3 consecutive integers while others can be non-consecutive integers. But from the result and solution, it seems like the subsequence should only be consecutive integers.


  • 0
    S

    Same problem.


  • 1

    [1,2,3,4,5,6,6,8,9,9]
    Expected: false

    Maybe I have missed something in the description, I think this is correct since we can split it as [1,2,3] and [4,5,6,6,8,9,9].
    https://discuss.leetcode.com/topic/100044/need-clarification-for-the-requirement


  • 2
    N

    @dingling1 You have a good point. The problem description is unclear (or considering your examples: 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." [1,2,3,4,4,5] yields false, because it doesn't satisfy the first condition. However, [1,2,3] satisfies both conditions and consequently yields true.


Log in to reply
 

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