659. Split Array into Consecutive Subsequences
Medium
Input: nums = [1,2,3,3,4,5]
Output:
true
Explanation:
nums can be split into the following subsequences:
[1,2,3,3,4,5] --> 1, 2, 3
[1,2,3,3,4,5] --> 3, 4, 5Last updated
Input: nums = [1,2,3,3,4,5]
Output:
true
Explanation:
nums can be split into the following subsequences:
[1,2,3,3,4,5] --> 1, 2, 3
[1,2,3,3,4,5] --> 3, 4, 5Last updated
Input: nums = [1,2,3,3,4,4,5,5]
Output:
true
Explanation:
nums can be split into the following subsequences:
[1,2,3,3,4,4,5,5] --> 1, 2, 3, 4, 5
[1,2,3,3,4,4,5,5] --> 3, 4, 5Input: nums = [1,2,3,4,4,5]
Output:
false
Explanation:
It is impossible to split nums into consecutive increasing subsequences of length 3 or more.// Some code