Hi there, I have a question about the example 3 in the question. I'm wondering why the output of [1,2,3,4,4,5] is false. I'm thinking that it can be split into two consecutive sequence as [1,2,4], [3,4,5].
Thanks for your help!
The same problem.
I tested the case of "[1,2,3,4]" and the output of it is true. I think it means that when the number of the sequence is 1, the result also OK for this question.
However, the output of "[1,2,3,4,4]" is false. But we can just split it into 1 sequence"[1,2,3,4,4]", which also satisfies the condition "each subsequences consist of at least 3 consecutive integers". Could anyone please explain it?
@sspri You are right. 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.". The output of [1,2,3,4,4] is false, because it doesn't satisfy the first condition (it has duplicate). However, [1,2,3,4] satisfies both conditions and consequently returns true.