1. You are given an integer array sorted in ascending order (may contain duplicates).
2. You need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers.
3. Return whether you can make such a split.
EXAMPLE 1
Input: [1,2,3,3,4,5]
Output: True
Explanation:
You can split them into two consecutive subsequences :
1, 2, 3
3, 4, 5
EXAMPLE 2
Input: [1,2,3,4,4,5]
Output: False
Input Format
First line contains N(size of the array). Second line contains N space separated sorted integers.
Output Format
Return boolean value.
Constraints
The length of the input is in range of [1, 10000]
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
13 1 2 3 3 5 5 5 6 7 10 12 13 14
Output
false